Matplotlib: change position of plot

matplotlib, python

Solution

You can also try

plt.subplots_adjust(bottom=0.19)

If 0.19 adds too much or too little space to see the x-label better, then try adjusting little by little up or down.

Problem

I did the following plot with the figure size (which should not be changed): ``` plt.figure(figsize=(14, 5)) ``` Unfortunately, the x-label is not fully visible. My question: Is it possible, to move the whole grafic to the top (because there would be enough space)? The code: ``` plt.figure(figsize=(14, 5)) plt.plot(time_load,load, linewidth=1.5) plt.grid(True) plt.tick_params(labelsize=16) plt.xlabel('Time [hours]',fontsize=16) plt.xlim([0,24]) plt.xticks([0,4,8,12,16,20,24]) plt.legend(loc="upper left",fontsize = 'large') ``` Thank you very much for your help!

Original source