Hello list,
I have LineCollection object: "l = matplotlib.collections.LineCollection()" which I want to save as image without any kind of margins.
What have I tried is following:
ax = plt.subplot(111)
ax.set_axis_off()
ax.add_collection(l)
ax.autoscale_view()
plt.savefig('img.png')
but there are still unwanted margins.
How to plot without margins?
Thanks
You might need to explicitly specify your axes object rather than relying on plt.subplot.
Try replacing 'ax = plt.sublplot(111)' with 'ax = plt.axes([0, 0, 1, 1])'.
Ryan
ยทยทยท
On 7/5/2013 12:44 PM, death jun wrote:
Hello list,
I have LineCollection object: "l = matplotlib.collections.LineCollection()" which I want to save as image without any kind of margins.
What have I tried is following:
ax = plt.subplot(111)
ax.set_axis_off()
ax.add_collection(l)
ax.autoscale_view()
plt.savefig('img.png')
but there are still unwanted margins.
How to plot without margins?
Thanks
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
06.07.2013, 16:23, "Ryan Nelson":
You might need to explicitly specify your axes object rather than
relying on plt.subplot.
Try replacing 'ax = plt.sublplot(111)' with 'ax = plt.axes([0, 0, 1, 1])'.
Ryan, thanks for your reply
Your suggestion works perfectly
Cheers