有关PLot的官方网址为:Plots
中文的简单教程为
环境配置
首先,安装plots包
Pkg.add("Plots")
#如果之前安装过,想使用最新版,运行如下命令
Pkg.checkout("Plots")
至少安装一个画图用的包,我四个都装啦
Pkg.add("PyPlot")
Pkg.add("GR")
Pkg.add("UnicodePlots")
Pkg.add("PlotlyJS")
最后,添加一些扩展
Pkg.add("StatPlots")
Pkg.add("PlotRecipes")
使用
example1:
代码:
using Plots
default(show = true)
plotly() #使用这个出的图在网页上
plot(rand(4,4),linewidth=2,title="My Plot1")
运行报错的话,可能是缺少某些包,按照提示Pkg.add(“XXXX”)
结果:
example2:
using Plots
default(show = true)
plotly() # #使用这个出的图在网页上
plot(rand(4,4),linewidth=2,title="My Plot1")
x = 1:10; y = rand(10)
pyplot()#使用这个图画在弹出的窗口的画布上
plot(x,y,linewidth=2,title="My Plot2")
结果
除了上面的图外,还在弹出窗口有:
后续
更多内容可以参考官网或者其他博客