1. 程式人生 > >julia/pyplot 繪圖加入標簽和標題

julia/pyplot 繪圖加入標簽和標題

sdn pop mat clas sso pyc == otl 安裝

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

畫出來的圖就是這樣了

技術分享

julia/pyplot 繪圖加入標簽和標題