現在、Figure Iのプロットはすべて以下のように透明で、ズームされた部分と元の部分を区別します。 主軸を透明にする方法、matplolibでzoomed_inset_axesを透明にしない方法
ズームされた部分の位置は "loc"キーワードには1、...、9オプションがあります。たとえば、座標を使用して好きな場所を指定できますか?
axins = zoomed_inset_axes(ax, 3, loc=5) # zoom = 6
私はあなたの修正目的を簡単なコードで書きました。
from pylab import *
import re
rc('font',family='Arial')
matplotlib.rc('legend', fontsize=24)
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
font = {'family' : 'Arial',
'weight' : 'normal',
'size' : 24}
fig = figure(figsize=(8,8))
fig.set_alpha(0.0)
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
x=[0,1]
y=[0,1]
plot(x,y)
axins = zoomed_inset_axes(ax, 3, loc=5) # zoom = 6
axins.plot(x,y)
# sub region of the original image
x1, x2, y1, y2 = 0.3, 0.4, 0.3,0.4
axins.set_xlim(x1, x2)
axins.set_ylim(y1, y2)
plt.xticks(visible=False)
plt.yticks(visible=False)
# draw a bbox of the region of the inset axes in the parent axes and
# connecting lines between the bbox and the inset axes area
mark_inset(ax, axins, loc1=2, loc2=3, fc="none", ec="0.5")
plt.draw()
plt.show()
fig.savefig('1.png', transparent=True)
以下は、この単純なコードのプロットです。ただ、savefig
へお電話の前に
最小限の自己完結型の例を私たちが作業するなら、この質問に答えるほうがはるかに簡単です。 –
ありがとうございました、サンプルコードが追加されました^^ – user3737702