python 2.7 - Tight layout for matplotlib 3d surface plot -


i trying create 3d surface plot in matplotlib. plot surface works fine using ax.plot_surface api. couldn't find way remove padding surrounding subplot. in fact, don't need outer axes go 0.0 1.0 @ all. how can remove padding? tried many suggestions stackoverflow "ax.autoscale_view('tight')" , "fig.tight_layout()". autoscale_view don't change , fig.tight_layout() not available in matplotlib version using. strict compatibility requirements have use old (version 0.99) version of matplotlib. ideas ?

for completeness have added sample source code using:

from mpl_toolkits.mplot3d import axes3d matplotlib import cm import matplotlib.pyplot plt import numpy np  fig = plt.figure(figsize = (18,12)) rect = fig.add_subplot(2, 3, 2).get_position() ax = axes3d(fig, rect) x = np.arange(-5, 5, 0.025) y = np.arange(-5, 5, 0.025) x, y = np.meshgrid(x, y) r = np.sqrt(x**2 + y**2) z = np.sin(r) surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.jet) ax.view_init(azim=-90, elev=90)  ax.axis('off')  plt.show() 

enter image description here


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -