I want to display only the plot graphic (or imshow) in matplotlib figure. I can remove the axis with pylab.axis('off') but I still have some grey borders in the figure
I give an example. I want to remove all and only keep the imshow domain (and keep the zoom available).
Many thanks.
In your case, you may want to reshape the figure window in order to fit the content's shape. For a squared window you can use:
fig = figure(figsize=(6, 6)) # width and height in inches
fig.tight_layout(pad=0.5) # distance betweeen the axis and the figure edge
Make sure to keep some space for the axis labels, if you need them. If you want just to change the background color, the comment of @JoeKington is the answer.
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.tight_layout
Try the margins() function (also an axis method): http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.margins
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With