-
大小: 1.06KB文件類型: .py金幣: 1下載: 0 次發布日期: 2021-03-01
- 語言: Python
- 標簽: malplotlib??箭頭??坐標軸??
資源簡介
用malplotlib作帶箭頭的坐標軸
代碼片段和文件信息
import?matplotlib.pyplot?as?plt
import?numpy?as?np
import?mpl_toolkits.axisartist?as?axisartist
fig?=?plt.figure()
#?新建artistaxes的兩種方法
ax?=?axisartist.Subplot(fig?111)
#?ax?=?axisartist.Axes(fig[0.10.10.80.8])
#?把新建軸區域添加到當前畫布上面
fig.add_subplot(ax)
#?fig.add_axes(ax)
ax.axis[:].set_visible(False)
#?新建x和y軸,讓他們帶箭頭
ax.axis[‘x‘]?=?ax.new_floating_axis(0?0)
ax.axis[‘y‘]?=?ax.new_floating_axis(1?0)
#設置x軸位實心箭頭,設置y軸位空心箭頭
ax.axis[‘x‘].set_axisline_style(“-|>“
評論
共有 條評論