Answers for "python remove whitespace around figure"

0

remove whitespace around figure matplotlib

plt.gca().set_axis_off()
plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, 
            hspace = 0, wspace = 0)
plt.margins(0,0)
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.savefig("filename.pdf", bbox_inches = 'tight',
    pad_inches = 0)

# contributor was unsure about how it works, but nonetheless, it works!
Posted by: Guest on June-14-2021
4

strip whitespace python

>>> s.strip()
'Hello  World   From Pankaj tnrtHi There'
Posted by: Guest on February-19-2020

Code answers related to "python remove whitespace around figure"

Python Answers by Framework

Browse Popular Code Answers by Language