|
From: Cory D. <cd...@st...> - 2005-11-08 15:27:23
|
Hi all, I prefer san serif ticklabels on my matplotlib plots. Can anyone suggest an easy of making this happen when using TeX/LateX to handle text? Cheers, Cory. -- --------------------------------------------------- Cory Davis Institute for Atmospheric and Environmental Science Room 307, Crew Building, Kings Buildings, University of Edinburgh. Edinburgh EH9 3JN phone: +44 131 6505092 www: http://www.geos.ed.ac.uk/contacts/homes/cdavis |
|
From: Robert K. <rk...@uc...> - 2005-11-08 15:48:34
|
Cory Davis wrote: > Hi all, > I prefer san serif ticklabels on my matplotlib plots. Can anyone suggest > an easy of making this happen when using TeX/LateX to handle text? Update to the latest CVS, and I believe everything will Just Work. -- Robert Kern rk...@uc... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
|
From: Cory D. <cd...@st...> - 2005-11-08 16:09:35
|
Thanks Robert, Unfortunately I can't easily do this on my work machine. Our sys-admins installed matplotlib release version 0.83.2. If your change is already in 0.84 I can get them to upgrade, but I don't think they are so keen on CVS. Can you suggest a quick hack in the meantime? Cheers, Cory. Robert Kern wrote: > Cory Davis wrote: > >>Hi all, >>I prefer san serif ticklabels on my matplotlib plots. Can anyone suggest >>an easy of making this happen when using TeX/LateX to handle text? > > > Update to the latest CVS, and I believe everything will Just Work. > -- --------------------------------------------------- Cory Davis Institute for Atmospheric and Environmental Science Room 307, Crew Building, Kings Buildings, University of Edinburgh. Edinburgh EH9 3JN phone: +44 131 6505092 www: http://www.geos.ed.ac.uk/contacts/homes/cdavis |
|
From: Paul B. <peb...@gm...> - 2005-11-08 17:23:41
|
On 11/8/05, Cory Davis <cd...@st...> wrote: > > Thanks Robert, > Unfortunately I can't easily do this on my work machine. Our sys-admins > installed matplotlib release version 0.83.2. If your change is already > in 0.84 I can get them to upgrade, but I don't think they are so keen on > CVS. Can you suggest a quick hack in the meantime? Have you read this page: http://matplotlib.sourceforge.net/fonts.html ? If not, then a brief summary is: You should be able set the default font in your matplotlibrc file. If you want the labels to be different than the res= t of the plot, then you'll need to create a FontProperties object and pass it to the axes.set_xlabel() method before plotting, i.e. > myaxes =3D plot(...) > myfont =3D FontProperties(fontfamily=3D'sanserif') > myaxes.set_label('my text', fontdict=3Dmyfont) > plot(...) See also the font_properties_demo.py -- Paul Cheers, > Cory. > > > Robert Kern wrote: > > Cory Davis wrote: > > > >>Hi all, > >>I prefer san serif ticklabels on my matplotlib plots. Can anyone sugges= t > >>an easy of making this happen when using TeX/LateX to handle text? > > > > > > Update to the latest CVS, and I believe everything will Just Work. > > > > -- > --------------------------------------------------- > Cory Davis > Institute for Atmospheric and Environmental Science > Room 307, Crew Building, Kings Buildings, > University of Edinburgh. Edinburgh EH9 3JN > phone: +44 131 6505092 > www: http://www.geos.ed.ac.uk/contacts/homes/cdavis > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Robert K. <rk...@uc...> - 2005-11-08 23:48:55
|
Paul Barrett wrote: > On 11/8/05, *Cory Davis* <cd...@st... > <mailto:cd...@st...>> wrote: > > Thanks Robert, > Unfortunately I can't easily do this on my work machine. Our sys-admins > installed matplotlib release version 0.83.2. If your change is already > in 0.84 I can get them to upgrade, but I don't think they are so > keen on > CVS. Can you suggest a quick hack in the meantime? > > Have you read this page: http://matplotlib.sourceforge.net/fonts.html ? It used to be that those settings were not honored when using (La)TeX. The relevant changes are in texmanager.py (and I don't recall if they are in 0.84). def get_tex_command(self, tex, fname): fontcmd = {'sans-serif' : r'{\sffamily %s}', 'monospace' : r'{\ttfamily %s}'}.get( rcParams['font.family'], r'{\rmfamily %s}') tex = fontcmd % tex Add that snippet to the method and you should be good to go. -- Robert Kern rk...@uc... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
|
From: Cory D. <cd...@st...> - 2005-11-09 11:00:40
|
Thanks Robert,
>
> The relevant changes are in texmanager.py (and I don't recall if they
> are in 0.84).
>
> def get_tex_command(self, tex, fname):
>
> fontcmd = {'sans-serif' : r'{\sffamily %s}',
> 'monospace' : r'{\ttfamily %s}'}.get(
> rcParams['font.family'], r'{\rmfamily %s}')
> tex = fontcmd % tex
>
> Add that snippet to the method and you should be good to go.
>
This is not in 0.84, so I guess I will wait for the next release.
Cheers,
Cory.
--
---------------------------------------------------
Cory Davis
Institute for Atmospheric and Environmental Science
Room 307, Crew Building, Kings Buildings,
University of Edinburgh. Edinburgh EH9 3JN
phone: +44 131 6505092
www: http://www.geos.ed.ac.uk/contacts/homes/cdavis
|
|
From: John H. <jdh...@ac...> - 2005-11-09 13:13:03
|
>>>>> "Cory" == Cory Davis <cd...@st...> writes:
Cory> Thanks Robert,
>> The relevant changes are in texmanager.py (and I don't recall
>> if they are in 0.84). def get_tex_command(self, tex, fname):
>> fontcmd = {'sans-serif' : r'{\sffamily %s}', 'monospace' :
>> r'{\ttfamily %s}'}.get( rcParams['font.family'], r'{\rmfamily
>> %s}') tex = fontcmd % tex Add that snippet to the method and
>> you should be good to go.
>>
Cory> This is not in 0.84, so I guess I will wait for the next
Cory> release. Cheers, Cory.
You should just be able to drop the CVS texmanager.py into your
site-packages/matplotlib dir and be off to the races
http://cvs.sourceforge.net/viewcvs.py/matplotlib/matplotlib/lib/matplotlib/texmanager.py?rev=1.31&view=markup
JDH
|
|
From: Cory D. <cd...@st...> - 2005-11-09 13:35:17
|
Hi John, > > You should just be able to drop the CVS texmanager.py into your > site-packages/matplotlib dir and be off to the races > > http://cvs.sourceforge.net/viewcvs.py/matplotlib/matplotlib/lib/matplotlib/texmanager.py?rev=1.31&view=markup Yes, but the whole problem is that I don't have superuser priveleges on my work machine. I realise I could have the CVS matplotlib in my own python library in my home directory, but for several reasons we decided that this isn't so nice. The sysadmins have, in some easily manageable way, put matplotlib 0.83.2 on all of the linux machines in our department, which is just great. When some killer feature is added, I can let them know and they can easily do the upgrade, but my impression is they are happier with releases than with CVS, and I don't want to push my luck. Also, its not such a big deal to wait for the next release. Cheers, Cory. > > JDH -- --------------------------------------------------- Cory Davis Institute for Atmospheric and Environmental Science Room 307, Crew Building, Kings Buildings, University of Edinburgh. Edinburgh EH9 3JN phone: +44 131 6505092 www: http://www.geos.ed.ac.uk/contacts/homes/cdavis |