On 30. mai. 2009, at 13.56, John Hunter wrote:
> On Sat, May 30, 2009 at 3:50 AM, Paul Anton Letnes
> <[email protected]> wrote:
>> Hello again,
>>
>>
>> I can set the figure size and font size, that all works fine.
>> However,
>> the legend is prohibitively large: for a plot 3 inches wide (why
>> doesn't matplotlib use centimeters or similar?), the legend takes up
>> about one third of the plot. This does not look too good...
>
> Please post a complete example. As for inches vs cm, that is my fault
> -- I can't remember if it was for matlab compatibility, or due to my
> provincial ways this side of the pond.
>
> JDH
Hi,
This is my function which does the plotting. The "coeffarr" is a 2D
array (function uses 7 first columns) with first column being
frequencies, other columns being real/imag part of whatever I'm
plotting.
#################
import matplotlib
matplotlib.use('ps')
import pylab
def plot(coeffarr):
'Do the actual plotting.'
nfreqs, ncoeffs = coeffarr.shape
legends = []
for i in range(1, 6, 2): # real part columns
pylab.plot(coeffarr[:,0], coeffarr[:,i], RE_STYLE)
legends.append('l = %i' % int((i + 1) / 2))
pylab.plot(coeffarr[:,0], coeffarr[:,i+1], IM_STYLE)
legends.append('l = %i' % int((i + 1) / 2))
pylab.legend(legends)
pylab.xlabel('Frequency [eV]')
pylab.ylabel('$A_{lm}R^{-l-1}$')
pylab.savefig(PLOTFILE)
####################
My matplotlibrc file is essentially this:
####################
backend : MacOSX # added by paulanto on 16. feb. 08
numerix : numpy # numpy, Numeric or numarray
lines.linewidth : 1.0 # line width in points
font.family : serif
font.size : 10.0
text.usetex : True
axes.linewidth : 1.0 # edge linewidth
legend.fontsize : 10.0
figure.figsize : 3.0, 2.3 # figure size in inches
####################
Is this complete enough? If you do the plot, you'll see that the plot
is about one column wide (7 cm-ish) and that the legend is relatively
large. I made similar size plots in Gnuplot before, at font size 10,
but the legend was somehow less dominant.
Also, will it help getting rid of the rectangle?
cheers,
Paul.
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users