|
From: Christian D. O. <chr...@gm...> - 2005-11-16 09:57:46
|
Hi,
I am a new user of matplotlib (0.82; python 2.3.5). So far I have
used supermongo (sic!) to produce figures for physics journal articles
and talks. I am trying to get up to speed with matplotlib to do the
same kind of plots with an open source package.
For talks I like to prepare eps figures which I embed in my latex-based
slides. For slides, huge font sizes are a must, hence I like to use
large fonts for tick mark labels and axis labels. My problem: For the
axis labels, matplolib (or the PS backend?) is apparently not
adjusting (or rather: under-adjusting) the distance between axis and
axis label.
Is there a way to adjust the distance between an axis and its label?
If not, then where in the code is the distance calculated, scaled and
set? I have dug through the code, but could not find it due
to lack of object-oriented programming experience, I guess.
Here is an example of what I mean. The x-axis labels comes out
sort of okay, but the y-axis label is to close to the y axis.
#!/usr/bin/python
from pylab import *
from matplotlib import rcParams
plot([1,2,3,4], [1,4,9,16], 'ro')
xlabel("something",size=3D30)
ylabel("something else",size=3D30)
xlabels =3D getp(gca(), 'xticklabels')
setp(xlabels, size=3D25)
ylabels =3D getp(gca(), 'yticklabels')
setp(ylabels, size=3D25)
savefig("testplot.eps")
Note that playing around with 'axes' did not help - it has
no influence on the distance between labels and axes.
Help & comments much appreciated! Thanks!
- Christian
|
|
From: Eric F. <ef...@ha...> - 2005-11-16 16:15:33
|
Christian,
Insert
rcParams['tick.major.pad'] = 12
as the third line in your script, or change the value in your
matplotlibrc file.
Eric
> For talks I like to prepare eps figures which I embed in my latex-based
> slides. For slides, huge font sizes are a must, hence I like to use
> large fonts for tick mark labels and axis labels. My problem: For the
> axis labels, matplolib (or the PS backend?) is apparently not
> adjusting (or rather: under-adjusting) the distance between axis and
> axis label.
>
> Is there a way to adjust the distance between an axis and its label?
> If not, then where in the code is the distance calculated, scaled and
> set? I have dug through the code, but could not find it due
> to lack of object-oriented programming experience, I guess.
>
> Here is an example of what I mean. The x-axis labels comes out
> sort of okay, but the y-axis label is to close to the y axis.
>
> #!/usr/bin/python
> from pylab import *
> from matplotlib import rcParams
>
> plot([1,2,3,4], [1,4,9,16], 'ro')
> xlabel("something",size=30)
> ylabel("something else",size=30)
> xlabels = getp(gca(), 'xticklabels')
> setp(xlabels, size=25)
> ylabels = getp(gca(), 'yticklabels')
> setp(ylabels, size=25)
> savefig("testplot.eps")
|
|
From: Christian D. O. <chr...@gm...> - 2005-11-16 16:52:57
|
Hi Eric, On 11/16/05, Eric Firing <ef...@ha...> wrote: > Insert > > rcParams['tick.major.pad'] =3D 12 > > as the third line in your script, or change the value in your > matplotlibrc file. thanks. But this merely changes the distance between ticks and tick labels. The distance between tick labels and axis label stays constant. To be more precise about what I need (my first e-mail was a bit ambigous...sorry): I need to change the distance between tick labels and the axis label. Thanks. - Christian |
|
From: Chris B. <Chr...@no...> - 2005-11-17 00:53:38
|
Sorry I can't help you with your problem, but I can offer an alternate solution: Rather than make the font really big, you could make the figure small, then scale the whole thing up, so that everything is bigger. This could work great for scalable back-ends like EPS. If you need a PNG, you should be able to accomplish it by manipulating the size and the dpi settings. See: http://www.scipy.org/wikis/topical_software/AdjustingImageSize For more info about this. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
|
From: Ryan K. <rya...@gm...> - 2005-11-16 17:31:43
|
I am confused as to what the problem is. Are you saying that your axis label is running into you tick label? Can you post a little piece of a png showing the problem you are trying to solve? Ryan On 11/16/05, Christian David Ott <chr...@gm...> wrote: > Hi Eric, > > On 11/16/05, Eric Firing <ef...@ha...> wrote: > > > Insert > > > > rcParams['tick.major.pad'] =3D 12 > > > > as the third line in your script, or change the value in your > > matplotlibrc file. > > thanks. But this merely changes the distance between ticks and tick > labels. The distance between tick labels and axis label stays > constant. To be more precise about what I need (my first e-mail was a > bit ambigous...sorry): I need to change the distance between tick > labels and the axis label. > > Thanks. > > - Christian > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. Get Certified Today > Register for a JBoss Training Course. Free Certification Exam > for All Training Attendees Through End of 2005. For more info visit: > http://ads.osdn.com/?ad_idv28&alloc_id=16845&opclick > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Christian D. O. <chr...@gm...> - 2005-11-16 17:41:54
|
Hi Ryan,
On 11/16/05, Ryan Krauss <rya...@gm...> wrote:
> I am confused as to what the problem is. Are you saying that your
> axis label is running into you tick label? Can you post a little
> piece of a png showing the problem you are trying to solve?
sorry, I don't know how to post a png to the mailinglist. Do I just
have to attach it to my response? Anyway, the below code generates a
plot that reproduces my problem. The y-axis label is to close to the
y-axis tick labels (though not overlapping). I would like to shift the
y-axis label further away from the y-axis tick labels.
- Christian
-------------
#!/usr/bin/python
from pylab import *
from matplotlib import rcParams
plot([1,2,3,4], [1,4,9,16], 'ro')
xlabel("something",size=3D30)
ylabel("something else",size=3D30)
xlabels =3D getp(gca(), 'xticklabels')
setp(xlabels, size=3D25)
ylabels =3D getp(gca(), 'yticklabels')
setp(ylabels, size=3D25)
savefig("testplot.eps")
|
|
From: Ryan K. <rya...@gm...> - 2005-11-16 20:08:49
|
I know correctly understand your problem, but I don't know how to fix
it. It seems you need a pad setting for the distance from the axis
label to the tick mark labels, but I don't see one in the rc file.
Anyone else?
Ryan
On 11/16/05, Christian David Ott <chr...@gm...> wrote:
> Hi Ryan,
>
> On 11/16/05, Ryan Krauss <rya...@gm...> wrote:
> > I am confused as to what the problem is. Are you saying that your
> > axis label is running into you tick label? Can you post a little
> > piece of a png showing the problem you are trying to solve?
>
> sorry, I don't know how to post a png to the mailinglist. Do I just
> have to attach it to my response? Anyway, the below code generates a
> plot that reproduces my problem. The y-axis label is to close to the
> y-axis tick labels (though not overlapping). I would like to shift the
> y-axis label further away from the y-axis tick labels.
>
> - Christian
>
> -------------
>
> #!/usr/bin/python
> from pylab import *
> from matplotlib import rcParams
>
> plot([1,2,3,4], [1,4,9,16], 'ro')
> xlabel("something",size=3D30)
> ylabel("something else",size=3D30)
> xlabels =3D getp(gca(), 'xticklabels')
> setp(xlabels, size=3D25)
> ylabels =3D getp(gca(), 'yticklabels')
> setp(ylabels, size=3D25)
> savefig("testplot.eps")
>
|
|
From: John H. <jdh...@ac...> - 2005-11-17 00:41:38
|
>>>>> "Ryan" == Ryan Krauss <rya...@gm...> writes:
Ryan> I know correctly understand your problem, but I don't know
Ryan> how to fix it. It seems you need a pad setting for the
Ryan> distance from the axis label to the tick mark labels, but I
Ryan> don't see one in the rc file.
There is an Axis property LABELPAD that can be set -- it has not been
exposed to rc yet but should be. Something like
ax.yaxis.LABELPAD = 5
should work for now. Let us know ....
JDH
|