|
From: Paul A. L. <pau...@gm...> - 2009-06-05 09:56:29
|
Hi Chaitanya (and everyone else),
thanks for some nice advice! The font and legend frame tips worked
quite well.
I would appreciate it if it was possible to remove the legend frame by
default, i.e. in the matplotlibrc file, if possible. In my opinion,
this frame clutters the plot unnecessarily; I rarely see such frames
in publications.
Thanks!
Paul.
Begin forwarded message:
> From: Chaitanya Krishna <ic...@gm...>
> Date: 3. juni 2009 08.26.07 GMT+02:00
> To: Paul Anton Letnes <pau...@gm...>
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] making publication quality plots
>
> Hi Paul,
>
> Can you try
> font.size: 10
> legend.fontsize: small [or medium] in your rc file.
>
> Defining the fontsize and then defining the fontsize of the xtick
> labels, legend etc with respect to this font size seems to work better
> than defining everything by hand.
>
> Switching off the legend frame does seem to save some place. You can
> use pylab.legend('your legend').draw_frame(False)
>
> Cheers,
> Chaitanya
>
> On Wed, Jun 3, 2009 at 8:11 AM, Paul Anton Letnes
> <pau...@gm...> wrote:
>> On 30. mai. 2009, at 13.56, John Hunter wrote:
>>
>>> On Sat, May 30, 2009 at 3:50 AM, Paul Anton Letnes
>>> <pau...@gm...> 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
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
|