using Plots
gr() # 使用GR作为绘图后端,也可以选择其他后端,比如pyplot()
= range(0, stop=2π, length=100) # 生成 x 值
x = sin.(x) # 计算对应的 y 值,这里使用了 Julia 的广播(broadcasting)特性
y
plot(x, y, label="sin(x)", xlabel="x", ylabel="sin(x)", title="Sine Function", lw=2)
43 画图
43.1 正弦图
43.2 Parametric Plots
Plot function pair (x(u), y(u))
. See 图 43.1 for an example.
using Plots
plot(sin,
x->sin(2x),
0,
2π,
=false,
leg=(0,:lavender)) fill