Discussion:
[Matplotlib-users] Shadows are really large in exported PNG file
Richard Stanton
2015-09-03 20:07:31 UTC
Permalink
I’m trying to create a pie chart for a presentation. If I turn on shadows, they look fine on the screen (in an IPython notebook), but when I export the file to a PNG file, the shadow is way larger, and looks pretty ugly. Is this a bug? And is there a way to shrink the size of the shadow?

Here’s some sample code that shows the problem:

import matplotlib.pyplot as plt
numbers = [4380.0, 2474.0, 158]
explode=(0, 0, 0.5)
plt.pie(numbers, explode=explode,shadow=True)
plt.axis('equal')
plt.savefig(‘grap.png’, dpi=400)

Thanks for any suggestions.

By the way, I’m using Matplotlib version 1.4.3 with the Anaconda distribution under OS X.

Richard Stanton
Richard Stanton
2015-09-03 20:13:31 UTC
Permalink
A quick follow-up: if I export to a jpg file, I get the same huge shadow. If I export to a PDF file, the shadow looks much more like it does on the screen.
Post by Richard Stanton
I’m trying to create a pie chart for a presentation. If I turn on shadows, they look fine on the screen (in an IPython notebook), but when I export the file to a PNG file, the shadow is way larger, and looks pretty ugly. Is this a bug? And is there a way to shrink the size of the shadow?
import matplotlib.pyplot as plt
numbers = [4380.0, 2474.0, 158]
explode=(0, 0, 0.5)
plt.pie(numbers, explode=explode,shadow=True)
plt.axis('equal')
plt.savefig(‘grap.png’, dpi=400)
Thanks for any suggestions.
By the way, I’m using Matplotlib version 1.4.3 with the Anaconda distribution under OS X.
Richard Stanton
Sterling Smith
2015-09-03 20:17:48 UTC
Permalink
For those who wonder what he means:

on the left is TkAgg; on the right is png.

-Sterling
Post by Richard Stanton
A quick follow-up: if I export to a jpg file, I get the same huge shadow. If I export to a PDF file, the shadow looks much more like it does on the screen.
I’m trying to create a pie chart for a presentation. If I turn on shadows, they look fine on the screen (in an IPython notebook), but when I export the file to a PNG file, the shadow is way larger, and looks pretty ugly. Is this a bug? And is there a way to shrink the size of the shadow?
import matplotlib.pyplot as plt
numbers = [4380.0, 2474.0, 158]
explode=(0, 0, 0.5)
plt.pie(numbers, explode=explode,shadow=True)
plt.axis('equal')
plt.savefig(‘grap.png’, dpi=400)
Thanks for any suggestions.
By the way, I’m using Matplotlib version 1.4.3 with the Anaconda distribution under OS X.
Richard Stanton
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Mark Voorhies
2015-09-03 21:03:58 UTC
Permalink
This appears to be DPI dependent.

Changing the last line of Richard's example to

plt.savefig("grap.png")

gives a PNG with a shadow similar to that generated by TkAgg.

--Mark
Post by Sterling Smith
on the left is TkAgg; on the right is png.
-Sterling
Post by Richard Stanton
A quick follow-up: if I export to a jpg file, I get the same huge shadow. If I
export to a PDF file, the shadow looks much more like it does on the screen.
Post by Richard Stanton
I’m trying to create a pie chart for a presentation. If I turn on shadows,
they look fine on the screen (in an IPython notebook), but when I export the
file to a PNG file, the shadow is way larger, and looks pretty ugly. Is this
a bug? And is there a way to shrink the size of the shadow?
import matplotlib.pyplot as plt
numbers = [4380.0, 2474.0, 158]
explode=(0, 0, 0.5)
plt.pie(numbers, explode=explode,shadow=True)
plt.axis('equal')
plt.savefig(‘grap.png’, dpi=400)
Thanks for any suggestions.
By the way, I’m using Matplotlib version 1.4.3 with the Anaconda distribution
under OS X.
Richard Stanton
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...