Answers for "remove white space in matplotlib"

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
0

python remove white space

>>> '     hello world!    '.strip() #remove both
'hello world!'

>>> '     hello world!'.lstrip() #remove leading whitespace
'hello world!'
Posted by: Guest on November-23-2021

Code answers related to "remove white space in matplotlib"

Python Answers by Framework

Browse Popular Code Answers by Language