gavanwanggw

导航

julia/pyplot 绘图加入标签和标题

julia 调用matplotlib.pyplot 须要先using pycall

先安装pycall

Pkg.add("PyCall")
然后吧。

上代码把:(应该是通俗易懂的)

x=[0.5:0.01:4.49]
y=sin(x)
using PyPlot
using PyCall
@pyimport matplotlib.pyplot as plt
fig,ax=plt.subplots()
ax[:plot](x,y,linewidth=1,label=L"$y = \sin(x)$",alpha=0.6)
plt.ylabel("sin(x)")
plt.xlabel("x")
plt.title("Fs-En Curves")
ax[:legend]()


须要注意的一点是 matplotlib 里的 import 这里要替换成 @pyimport

画出来的图就是这样了



posted on 2017-06-05 11:27  gavanwanggw  阅读(2299)  评论(0编辑  收藏  举报