python - matplotlib figure inset whitespace -
i'm making figure includes inset. cannot figure out how whitespace on removed. i've tried using tight_sublot()
still leaves whitespace near inset i'd remove. suggestions?
import numpy np mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot plt import silicon2_data data = silicon2_data.out fig = plt.figure() ax = fig.add_subplot(111, projection='3d') temperature in data: xs = temperature[:,0] ys = temperature[:,1] zs = temperature[:,2] ax.scatter(xs, ys, zs) ax.set_zbound(0, 1.4) ax.set_xlabel(r'$2\theta$ (degrees)') ax.set_ylabel('temperature (k)') ax.set_zlabel(r'intensity ($10^5$cts/sec)') #inset ax2 = fig.add_axes([0.15, 0.62, 0.25, 0.25]) ax2.plot(data[3,:,0], data[3,:,2],'bo') ax2.plot(data[7,:,0], data[7,:,2],'rx') ax2.legend(('16k', '18k'), loc=0, fontsize ='small') ax2.set_ybound(0, 1.4) plt.tight_layout() plt.show()
this i'm trying make:
after calling
fig = plt.figure()
you can adjust characteristics of subplots before adding them fig.add_subplot()
using pyplot's subplots_adjust()
method. purposes, might try
fig.subplots_adjust(wspace=0.05) fig.subplots_adjust(hspace=0.05)
where number fraction of figure's width or height.
Comments
Post a Comment