如果你想在较大的一个中插入一个小图,你可以使用Axes,就像这里一样.
问题是我不知道如何在子图中做同样的事情.
我有几个子图,我想在每个子图中绘制一个小图.示例代码将是这样的:
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
for i in range(4):
ax = fig.add_subplot(2,2,i)
ax.plot(np.arange(11),np.arange(11),'b')
#b = ax.axes([0.7,0.7,0.2,0.2])
#it gives an error, AxesSubplot is not callable
#b = plt.axes([0.7,0.7,0.2,0.2])
#plt.plot(np.arange(3),np.arange(3)+11,'g')
#it plots the small plot in the selected position of the whole figure, not inside the subplot
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
提前致谢!