关于在 matplotlib 中的子图中嵌入小图的帖子的帖子,我正在研究这个解决方案,但由于某种原因,转换被忽略了!
我错了吗?还是有错误?
import matplotlib.pyplot as plt
import numpy as np
axes = []
x = np.linspace(-np.pi,np.pi)
fig = plt.figure(figsize=(10,10))
subpos = (0,0.6)
for i in range(4):
axes.append(fig.add_subplot(2,2,i))
for axis in axes:
axis.set_xlim(-np.pi,np.pi)
axis.set_ylim(-1,3)
axis.plot(x,np.sin(x))
fig.add_axes([0.5,0.5,0.1,0.1],transform=axis.transAxes)
plt.show()