Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

python - Increasing whitespace/greyspace ratio in 3D surface plot

I need to save a 3D-plot image, but the title and part of the z-axis ticks are found outside of the whitespace, in the grey area, and this causes problems in the following animation I am making.

import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm


fig_anim = plt.figure(figsize=(18,13))
ax = fig_anim.gca(projection='3d')

u_displ_time = np.loadtxt('t-index=0.txt')
plot = [ax.plot_surface(xx, yy, u_displ_time, cmap='jet', rstride=1, cstride=1, linewidth=0.5, edgecolor='black')]
title = 'random title'
ax.set_title(title, loc='center', pad=0.01, fontsize=25)

fig_anim.savefig('test_plot')

t-index=0.txt is just a text files with n rows and n columns. I cannot post it here, but it shouldn't be so important. Does anyone know how to fix this? I tried with tight_layout but it does not seem to help.

Thanks a lot!

Image showing that the title, the z-axis label and part of its axis ticks are not in the whitespace.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...