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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…