Dip*_*ole 10 python matplotlib
我想将我为一个图形设置的子图轴数据分配给另一个图形,如下所示。
import matplotlib.pyplot as plt
x = [1,2,3]
y = [1,2,3]
fig1, ax1 = plt.subplots(1,2,sharey=True)
ax1[0].plot(x,y)
ax1[0].set_xlabel("x")
ax1[0].set_ylabel("y")
fig2, ax2 = plt.subplots(4,4,sharex=True,sharey=True)
ax2[0,0] = ax1[0] # I was expecting this to set all the axis labels and plot data from ax1
plt.show()
Run Code Online (Sandbox Code Playgroud)
请注意,我在matplotlib 中看到了答案:我可以创建 AxesSubplot 对象,然后将它们添加到 Figure 实例吗?
我尝试使用fig2.axes.append(ax1)但这不起作用。我希望所有设置在ax1[0]of的属性都fig1被复制并显示在fig2
| 归档时间: |
|
| 查看次数: |
5641 次 |
| 最近记录: |