Re: [Matplotlib-users] Switching between different font settings

2009-02-27 Thread mochuk

Hi all,


Johan Ekh-2 wrote:
> 
> 
> What is the most convenient way to get Matplotlib to use the same fonts as
> my main document and also to quickly switch between the
> different document types?
> 
> 

Take a look at: http://dtrx.de/od/tex/sfmath.html
You have to load the package in the preambel of LaTeX.
For matplotlib this can be done by adding "text.latex.preamble :
\usepackage{sfmath}" to your matplotlibrc.

Best regards,
Tobias
-- 
View this message in context: 
http://www.nabble.com/Switching-between-different-font-settings-tp21279388p22245329.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Switching between different font settings

2009-02-27 Thread mochuk

Hi all,


Johan Ekh-2 wrote:
> 
> 
> What is the most convenient way to get Matplotlib to use the same fonts as
> my main document and also to quickly switch between the
> different document types?
> 
> 

Take a look at: http://dtrx.de/od/tex/sfmath.html

Best regards,
Tobias
-- 
View this message in context: 
http://www.nabble.com/Switching-between-different-font-settings-tp21279388p22245251.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Switching between different font settings

2009-01-08 Thread Johan Ekh
OK,
Thanks for your help.
// Johan

On Wed, Jan 7, 2009 at 7:36 PM, Jouni K. Seppänen  wrote:

> "Johan Ekh"  writes:
>
> > I am trying to use helvetica and yes, text(r'$1+2+3={}$1+2+3') gives me
> > helvetica for the non math mode case.
> > But how do I get math mode to use the same font?
>
> You can't. The problem is that while Helvetica contains all the usual
> letters and numbers, TeX math fonts must include Greek letters and a
> variety of symbols. (There exists a commercial Helvetica-like math font
> called HV Math from Micropress Inc.)
>
> Instead of getting math mode to use Helvetica, you want to make the tick
> labels use text mode. I don't think there is existing support for that
> in Matplotlib, but take a look at the Formatter classes in ticker.py -
> if the functionality of OldScalarFormatter is enough for you, use that,
> otherwise you'll have to hack ScalarFormatter to do what you want. If
> you want the labels to look like they do right now except for the font
> of the numbers, I think you could just wrap every number in
> \textsf{...}, but there could be problems with spacing.
>
> > I've tried to set 'mathtext.rm': 'sans-serif' in my params dict
>
> The mathtext options have no effect in usetex mode - everything gets
> rendered by TeX.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> --
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Switching between different font settings

2009-01-07 Thread Jouni K . Seppänen
"Johan Ekh"  writes:

> I am trying to use helvetica and yes, text(r'$1+2+3={}$1+2+3') gives me
> helvetica for the non math mode case.
> But how do I get math mode to use the same font?

You can't. The problem is that while Helvetica contains all the usual
letters and numbers, TeX math fonts must include Greek letters and a
variety of symbols. (There exists a commercial Helvetica-like math font
called HV Math from Micropress Inc.)

Instead of getting math mode to use Helvetica, you want to make the tick
labels use text mode. I don't think there is existing support for that
in Matplotlib, but take a look at the Formatter classes in ticker.py -
if the functionality of OldScalarFormatter is enough for you, use that,
otherwise you'll have to hack ScalarFormatter to do what you want. If
you want the labels to look like they do right now except for the font
of the numbers, I think you could just wrap every number in
\textsf{...}, but there could be problems with spacing.

> I've tried to set 'mathtext.rm': 'sans-serif' in my params dict

The mathtext options have no effect in usetex mode - everything gets
rendered by TeX.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Switching between different font settings

2009-01-06 Thread Johan Ekh
Thank you for your answer!
I am trying to use helvetica and yes, text(r'$1+2+3={}$1+2+3') gives me
helvetica for the non math mode case.
But how do I get math mode to use the same font? I've tried to set
'mathtext.rm': 'sans-serif' in my params dict
and then run "rcParams.update(params)" but that did not help. Do you know
what I should do?

// Johan



On Mon, Jan 5, 2009 at 2:06 PM, Jouni K. Seppänen  wrote:

> "Johan Ekh"  writes:
>
> > So far I've tried reading a file with settings specific to the current
> > document and using "rcParams.update(params)" to dynamically change the
> > settings.
>
> This seems to me to be a good way of switching between settings.
>
> > This way I can get the right font for legends and labels, but
> > I have not figured out how to get correct fonts for the numbers
> > on the x- and y-axes. Matplotlib uses whatever is default in my LaTeX
> > installation (Computer Modern?). I use "text.usetex: True".
>
> The usetex support attempts to select a font from the same list used by
> matplotlib otherwise. I'm not sure if it's properly documented anywhere,
> but the machinery is in texmanager.py, and here's the relevant data
> structure:
>
>font_info = {'new century schoolbook': ('pnc',
>
>  r'\renewcommand{\rmdefault}{pnc}'),
>'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
>'times': ('ptm', r'\usepackage{mathptmx}'),
>'palatino': ('ppl', r'\usepackage{mathpazo}'),
>'zapf chancery': ('pzc', r'\usepackage{chancery}'),
>'cursive': ('pzc', r'\usepackage{chancery}'),
>'charter': ('pch', r'\usepackage{charter}'),
>'serif': ('cmr', ''),
>'sans-serif': ('cmss', ''),
>'helvetica': ('phv', r'\usepackage{helvet}'),
>'avant garde': ('pag', r'\usepackage{avant}'),
>'courier': ('pcr', r'\usepackage{courier}'),
>'monospace': ('cmtt', ''),
>'computer modern roman': ('cmr', ''),
>'computer modern sans serif': ('cmss', ''),
>'computer modern typewriter': ('cmtt', '')}
>
> What font are you trying to use? Is it one of those listed above?
>
> Since you say that you get the right font for legends and labels but not
> for tick labels, perhaps the problem is with math mode. What font do you
> get if you typeset a formula? Try something like
>
>  text(r'$1+2+3={}$1+2+3')
>
> to see if the math font is different from the text font.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Switching between different font settings

2009-01-05 Thread Jouni K . Seppänen
"Johan Ekh"  writes:

> So far I've tried reading a file with settings specific to the current
> document and using "rcParams.update(params)" to dynamically change the
> settings.

This seems to me to be a good way of switching between settings.

> This way I can get the right font for legends and labels, but
> I have not figured out how to get correct fonts for the numbers
> on the x- and y-axes. Matplotlib uses whatever is default in my LaTeX
> installation (Computer Modern?). I use "text.usetex: True".

The usetex support attempts to select a font from the same list used by
matplotlib otherwise. I'm not sure if it's properly documented anywhere,
but the machinery is in texmanager.py, and here's the relevant data
structure:

font_info = {'new century schoolbook': ('pnc',
r'\renewcommand{\rmdefault}{pnc}'),
'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
'times': ('ptm', r'\usepackage{mathptmx}'),
'palatino': ('ppl', r'\usepackage{mathpazo}'),
'zapf chancery': ('pzc', r'\usepackage{chancery}'),
'cursive': ('pzc', r'\usepackage{chancery}'),
'charter': ('pch', r'\usepackage{charter}'),
'serif': ('cmr', ''),
'sans-serif': ('cmss', ''),
'helvetica': ('phv', r'\usepackage{helvet}'),
'avant garde': ('pag', r'\usepackage{avant}'),
'courier': ('pcr', r'\usepackage{courier}'),
'monospace': ('cmtt', ''),
'computer modern roman': ('cmr', ''),
'computer modern sans serif': ('cmss', ''),
'computer modern typewriter': ('cmtt', '')}

What font are you trying to use? Is it one of those listed above?

Since you say that you get the right font for legends and labels but not
for tick labels, perhaps the problem is with math mode. What font do you
get if you typeset a formula? Try something like

  text(r'$1+2+3={}$1+2+3')

to see if the math font is different from the text font.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users