簡體   English   中英

matplotlib inset_axis插入位置的刻度標簽與父軸重疊

[英]matplotlib inset_axis inset placement has tick labels overlapping parent axes

當我使用inset_axes將插圖放置在圖形中時,對於較小的圖形,該插圖的刻度標簽將與軸框架重疊。 有沒有一種方法可以調整身材以避免此問題?

碼:

fig, ax1 = plt.subplots()

ax1.plot(dd1["mag"].index, dd1["mag"], '.-',label="$\omega$")
ax1.plot(newindex,curvy1,'--', label="${0:.3f} \cdot I$".format(popt1[0]))
ax1.set_xlim((5e11, 5e13))
ax1.set_ylim((2e-7,.25e-4))

ax1_inset = inset_axes(ax1, width="40%", height="40%", loc=4)
ax1_inset.plot(dd1["mag"].index, (one - np.array(dd1["mag"]))/one)
ax1_inset.plot(dd1["mag"].index, map(lambda x: -.01, dd1["mag"].index), ':')
ax1_inset.set_xlim(5e11,5e13)
ax1_inset.set_ylim(-.1,.05)
ax1_inset.set_xscale("log")

使用matplotlibrc值:

matplotlib.rcParams['figure.figsize'] = '4,3'

matplotlib.rcParams['axes.formatter.use_mathtext'] = 'True'
matplotlib.rcParams['axes.formatter.useoffset'] = 'False'

matplotlib.rcParams['figure.subplot.left'] = .22
matplotlib.rcParams['figure.subplot.right'] = .95
matplotlib.rcParams['figure.subplot.bottom'] = .20
matplotlib.rcParams['figure.subplot.top'] = .90

實例圖

kwarg“ borderpad”似乎可以解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM