|
From: Petro K. <kho...@gm...> - 2012-08-22 12:17:53
|
Damon McDougall <dam...@gm...> 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/AAAAAAAACls/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. |