I have a plot with a zoomed_inset_axis object, as seen in eg https://matplotlib.org/3.1.1/_images/sphx_glr_inset_locator_demo2_001.png
Now i want my parent axes object to be despined in a certain way, so the right spine is not visible. If i do that though, my zoomed inset is also despined in the same way, which i do not want. I assume that happens because it has the axes object as a parent.
Is there any way to change that? Basically i want a despined parent object and a zoomed inset that i surrounded by a "normal" box.
I tried seabon.despine(fig=fig, ax=ax)
, but that also despined my zoomed in object. I also tried ax.spines['right'].set_visible=False
, but that also despined my zoomed object
fig, ax = plt.subplots(1,1)
axins = zoomed_inset_axes(ax, 7, loc=4)
seaborn.despine(fig=fig,ax=ax, offset=10)
Both of the following work as expected:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
import seaborn as sns
fig, ax = plt.subplots(1,1)
axins = zoomed_inset_axes(ax, .5, loc=4)
sns.despine(ax=ax, offset=10)
plt.show()
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
fig, ax = plt.subplots(1,1)
axins = zoomed_inset_axes(ax, .5, loc=4)
ax.spines['right'].set_visible(False)
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.