You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is what you want. Note that the inset axes is just an axes so you must plot something on it (for a zoom operation it naturally is the same thing you plotted in the regular axes).
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, mark_inset
ax = plt.subplot(111)
ax.set_xlim(0,100)
ax.set_ylim(0,100)
x = np.arange(0, 100, 0.1)
y = x
X, Y = np.meshgrid(x, y)
Z = X*Y -X -Y
ax.contour(X, Y, Z)
axins = zoomed_inset_axes(ax, 2.5, loc=1)
axins.contour(X, Y, Z)
axins.set_xlim(30, 40)
axins.set_ylim(35, 45)
mark_inset(ax, axins, loc1=2, loc2=4, fc='none')
plt.xticks(visible=False)
plt.yticks(visible=False)
plt.show()
Run this code and got a image witch the contour showed correctly but zoomed axes were empty. However, I changed the order of code like:
Then I got a contour empty but zoomed axes showed correctly image.
Is this a defect of zoomed_inset_axes?
The text was updated successfully, but these errors were encountered: