[Matplotlib-users] problem with png image
Hi list. I generate some png images using matplotlib, and get very different results depending on figuresize __ from pylab import figure, plot import pylab as plt import numpy as np figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates1.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the code above generates the following image: https://lh3.googleusercontent.com/-107Ducz_CA0/UDShKMtejtI/Cls/YOeahS3tQA8/s400/fit_rates1.png now if I increase a figure size parameter: __ from pylab import figure, plot import pylab as plt import numpy as np plt.ioff() from matplotlib import rcParams golden_mean = (np.sqrt(5)-1.0)/2.0# Aesthetic ratio fig_width = 5.6 # width in inches fig_height = fig_width*golden_mean# height in inches rcParams['figure.figsize']=fig_width, fig_height*3 figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates2.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the result looks strange like this: https://lh5.googleusercontent.com/-4GRQxuRFvh4/UDSiRrNy59I/CmA/Kho3prHFpUU/s640/fit_rates2.png Has anyone experienced behaviour like this? Thanks. Petro -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with png image
On Wed, Aug 22, 2012 at 11:28:54AM +0200, Petro wrote: Hi list. I generate some png images using matplotlib, and get very different results depending on figuresize __ from pylab import figure, plot import pylab as plt import numpy as np figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates1.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the code above generates the following image: https://lh3.googleusercontent.com/-107Ducz_CA0/UDShKMtejtI/Cls/YOeahS3tQA8/s400/fit_rates1.png now if I increase a figure size parameter: __ from pylab import figure, plot import pylab as plt import numpy as np plt.ioff() from matplotlib import rcParams golden_mean = (np.sqrt(5)-1.0)/2.0# Aesthetic ratio fig_width = 5.6 # width in inches fig_height = fig_width*golden_mean# height in inches rcParams['figure.figsize']=fig_width, fig_height*3 figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates2.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) What backend are you using? print plt.get_backend() -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with png image
Damon McDougall damon.mcdoug...@gmail.com writes: On Wed, Aug 22, 2012 at 11:28:54AM +0200, Petro wrote: Hi list. I generate some png images using matplotlib, and get very different results depending on figuresize __ from pylab import figure, plot import pylab as plt import numpy as np figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates1.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the code above generates the following image: https://lh3.googleusercontent.com/-107Ducz_CA0/UDShKMtejtI/Cls/YOeahS3tQA8/s400/fit_rates1.png now if I increase a figure size parameter: __ from pylab import figure, plot import pylab as plt import numpy as np plt.ioff() from matplotlib import rcParams golden_mean = (np.sqrt(5)-1.0)/2.0# Aesthetic ratio fig_width = 5.6 # width in inches fig_height = fig_width*golden_mean# height in inches rcParams['figure.figsize']=fig_width, fig_height*3 figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates2.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) What backend are you using? print plt.get_backend() It outputs GTK. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with png image
Can you try the GtkAgg backend instead and confirm the bug isn't there? The pure Gtk backend doesn't see a lot of use these days and isn't very well tested. Mike On 08/22/2012 08:17 AM, Petro Khoroshyy wrote: Damon McDougall damon.mcdoug...@gmail.com writes: On Wed, Aug 22, 2012 at 11:28:54AM +0200, Petro wrote: Hi list. I generate some png images using matplotlib, and get very different results depending on figuresize __ from pylab import figure, plot import pylab as plt import numpy as np figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates1.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the code above generates the following image: https://lh3.googleusercontent.com/-107Ducz_CA0/UDShKMtejtI/Cls/YOeahS3tQA8/s400/fit_rates1.png now if I increase a figure size parameter: __ from pylab import figure, plot import pylab as plt import numpy as np plt.ioff() from matplotlib import rcParams golden_mean = (np.sqrt(5)-1.0)/2.0# Aesthetic ratio fig_width = 5.6 # width in inches fig_height = fig_width*golden_mean# height in inches rcParams['figure.figsize']=fig_width, fig_height*3 figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates2.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) What backend are you using? print plt.get_backend() It outputs GTK. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with png image
Michael Droettboom md...@stsci.edu writes: Can you try the GtkAgg backend instead and confirm the bug isn't there? The pure Gtk backend doesn't see a lot of use these days and isn't very well tested. Mike Thanks. It solved the problem. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users