default mathtext font

Hello
I there a way to change the default mathtext font from cal to rm ?
I would like to use the rm (serif) font without stating rm{…} or mathrm{…}.
Is it possible to do using the matplotlibrc ?

can you give me an example of how this is done ?

Thanks
Eli

Hi all,
just to know if there's a proper way to convert a basemap generated with contourf to a KML (or polygon shapefile) ?
Thanks

···

--
Lionel Roubeyrie - lroubeyrie@...1068...
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr

Unfortunately there isn't. This is *theoretically* possible with the STIX fonts, but that hasn't been implemented. However, with the Computer Modern fonts, many of the glyphs simply aren't present (upright Greek, for example) to make this happen.

That said, I'm not sure this is necessarily a good idea. Math has a set of commonly accepted conventions about when to use italic vs. upright that may only confuse the reader when not followed. Can you provide a use case?

Cheers,
Mike

Eli Brosh wrote:

···

Hello
I there a way to change the default mathtext font from cal to rm ?
I would like to use the rm (serif) font without stating rm{...} or mathrm{...}.
Is it possible to do using the matplotlibrc ?
can you give me an example of how this is done ?

Thanks
Eli
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Here is the use case I have in mind:
Plotting properties of various phases of iron, I need a legend with greek letters and normal text:
\alpha-Fe, Someone (2003)

Now, I need the names e.g. someone to be upright.

Also, the relbar between \alpha and Fe is shorter with normal text fonts than with italics.

I can solve the problem by using r’\rm{\alpha-Fe, Someone (2003)}’ but it would be easier if I could just change the defaults.

Eli

···

On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom <mdroe@…86…> wrote:

Unfortunately there isn’t. This is theoretically possible with the STIX fonts, but that hasn’t been implemented. However, with the Computer Modern fonts, many of the glyphs simply aren’t present (upright Greek, for example) to make this happen.

That said, I’m not sure this is necessarily a good idea. Math has a set of commonly accepted conventions about when to use italic vs. upright that may only confuse the reader when not followed. Can you provide a use case?

Cheers,

Mike

Eli Brosh wrote:

Hello

I there a way to change the default mathtext font from cal to rm ?

I would like to use the rm (serif) font without stating rm{…} or mathrm{…}.

Is it possible to do using the matplotlibrc ?

can you give me an example of how this is done ?

Thanks

Eli



This SF.Net email is sponsored by the Moblin Your Move Developer’s challenge

Build the coolest Linux based applications with Moblin SDK & win great prizes

Grand prize is a trip for two to an Open Source event anywhere in the world

http://moblin-contest.org/redirect.php?banner_id=100&url=/



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

As an alternative, you could just use Unicode to insert the Greek characters:

r"α-Fe (Someone 2003)"

The default font used by matplotlib, Vera Sans, includes a full set of Greek characters. This, of course, requires an editor that supports Unicode and a coding directive at the top of your source files, eg.:

# -*- coding: utf-8 -*-

Cheers,
Mike

Eli Brosh wrote:

···

Here is the use case I have in mind:
Plotting properties of various phases of iron, I need a legend with greek letters and normal text:
\alpha-Fe, Someone (2003)

Now, I need the names e.g. someone to be upright.
Also, the relbar between \alpha and Fe is shorter with normal text fonts than with italics.

I can solve the problem by using r'\rm{\alpha-Fe, Someone (2003)}' but it would be easier if I could just change the defaults.

Eli

On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom <mdroe@...86... > <mailto:mdroe@…86…>> wrote:

    Unfortunately there isn't. This is *theoretically* possible with
    the STIX fonts, but that hasn't been implemented. However, with
    the Computer Modern fonts, many of the glyphs simply aren't
    present (upright Greek, for example) to make this happen.

    That said, I'm not sure this is necessarily a good idea. Math has
    a set of commonly accepted conventions about when to use italic
    vs. upright that may only confuse the reader when not followed.
    Can you provide a use case?

    Cheers,
    Mike

    Eli Brosh wrote:

        Hello
        I there a way to change the default mathtext font from cal to rm ?
        I would like to use the rm (serif) font without stating
        rm{...} or mathrm{...}.
        Is it possible to do using the matplotlibrc ?
        can you give me an example of how this is done ?

        Thanks
        Eli
        ------------------------------------------------------------------------

        -------------------------------------------------------------------------
        This SF.Net email is sponsored by the Moblin Your Move
        Developer's challenge
        Build the coolest Linux based applications with Moblin SDK &
        win great prizes
        Grand prize is a trip for two to an Open Source event anywhere
        in the world
        http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;
        ------------------------------------------------------------------------

        _______________________________________________
        Matplotlib-users mailing list
        Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>
        matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thanks,
This seems to be a solution.
I have an editor that supports unicode.
But, can you please explain better how do I make the coding directive at the top of my source files ?
Where do I write the command:

-- coding: utf-8 --

Is it inside the python script ?

Sorry for the ignorance.
Eli

···

On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom <mdroe@…86…> wrote:

As an alternative, you could just use Unicode to insert the Greek characters:

r"α-Fe (Someone 2003)"

The default font used by matplotlib, Vera Sans, includes a full set of Greek characters. This, of course, requires an editor that supports Unicode and a coding directive at the top of your source files, eg.:

-- coding: utf-8 --

Cheers,

Mike

Eli Brosh wrote:

Here is the use case I have in mind:

Plotting properties of various phases of iron, I need a legend with greek letters and normal text:

\alpha-Fe, Someone (2003)

Now, I need the names e.g. someone to be upright.

Also, the relbar between \alpha and Fe is shorter with normal text fonts than with italics.

I can solve the problem by using r’\rm{\alpha-Fe, Someone (2003)}’ but it would be easier if I could just change the defaults.

Eli

On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom <mdroe@…86… mailto:mdroe@...86...> wrote:

Unfortunately there isn't. This is *theoretically* possible with

the STIX fonts, but that hasn't been implemented. However, with

the Computer Modern fonts, many of the glyphs simply aren't

present (upright Greek, for example) to make this happen.



That said, I'm not sure this is necessarily a good idea. Math has

a set of commonly accepted conventions about when to use italic

vs. upright that may only confuse the reader when not followed.

Can you provide a use case?



Cheers,

Mike



Eli Brosh wrote:



    Hello

    I there a way to change the default mathtext font from cal to rm ?

    I would like to use the rm (serif) font without stating

    rm{...} or mathrm{...}.

    Is it possible to do using the matplotlibrc ?

    can you give me an example of how this is done ?



    Thanks

    Eli

    ------------------------------------------------------------------------



    -------------------------------------------------------------------------

    This SF.Net email is sponsored by the Moblin Your Move

    Developer's challenge

    Build the coolest Linux based applications with Moblin SDK &

    win great prizes

    Grand prize is a trip for two to an Open Source event anywhere

    in the world

    [http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>

    ------------------------------------------------------------------------



    _______________________________________________

    Matplotlib-users mailing list

    Matplotlib-users@lists.sourceforge.net

mailto:Matplotlib-users@lists.sourceforge.net

    [https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)

Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA

Yes, you would put it at the top of your .py file.

In order to use Unicode in Python source code, you have to tell the Python interpreter what encoding the file is in. That's done with a little "magic" comment at the top of the file. The popular Unixy editors (emacs, vim etc.) also understand this comment and will save the file correctly. Possibly other editors do as well.

For more gory details that you probably need, see this:

http://www.amk.ca/python/howto/unicode

particularly the section "Unicode Literals in Python Source Code".

Cheers,
Mike

Eli Brosh wrote:

···

Thanks,
This seems to be a solution.
I have an editor that supports unicode.
But, can you please explain better how do I make the coding directive at the top of my source files ?
Where do I write the command:
# -*- coding: utf-8 -*-

Is it inside the python script ?

Sorry for the ignorance.
Eli

On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom <mdroe@...86... > <mailto:mdroe@…86…>> wrote:

    As an alternative, you could just use Unicode to insert the Greek
    characters:

    r"�-Fe (Someone 2003)"

    The default font used by matplotlib, Vera Sans, includes a full
    set of Greek characters. This, of course, requires an editor that
    supports Unicode and a coding directive at the top of your source
    files, eg.:

    # -*- coding: utf-8 -*-

    Cheers,
    Mike

    Eli Brosh wrote:

        Here is the use case I have in mind:
        Plotting properties of various phases of iron, I need a legend
        with greek letters and normal text:
        \alpha-Fe, Someone (2003)

        Now, I need the names e.g. someone to be upright.
        Also, the relbar between \alpha and Fe is shorter with normal
        text fonts than with italics.

        I can solve the problem by using r'\rm{\alpha-Fe, Someone
        (2003)}' but it would be easier if I could just change the
        defaults.

        Eli

        On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom > <mdroe@...86... <mailto:mdroe@…86…> > <mailto:mdroe@…86…>> wrote:

           Unfortunately there isn't. This is *theoretically* possible
        with
           the STIX fonts, but that hasn't been implemented. However, with
           the Computer Modern fonts, many of the glyphs simply aren't
           present (upright Greek, for example) to make this happen.

           That said, I'm not sure this is necessarily a good idea.
        Math has
           a set of commonly accepted conventions about when to use italic
           vs. upright that may only confuse the reader when not followed.
           Can you provide a use case?

           Cheers,
           Mike

           Eli Brosh wrote:

               Hello
               I there a way to change the default mathtext font from
        cal to rm ?
               I would like to use the rm (serif) font without stating
               rm{...} or mathrm{...}.
               Is it possible to do using the matplotlibrc ?
               can you give me an example of how this is done ?

               Thanks
               Eli
                      ------------------------------------------------------------------------

                      -------------------------------------------------------------------------
               This SF.Net email is sponsored by the Moblin Your Move
               Developer's challenge
               Build the coolest Linux based applications with Moblin
        SDK &
               win great prizes
               Grand prize is a trip for two to an Open Source event
        anywhere
               in the world
                      http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;
                      <http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;&gt;
                      ------------------------------------------------------------------------

               _______________________________________________
               Matplotlib-users mailing list
               Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>
               <mailto:Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>>

                      matplotlib-users List Signup and Options

    -- Michael Droettboom
    Science Software Branch
    Operations and Engineering Division
    Space Telescope Science Institute
    Operated by AURA for NASA

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thanks,
This unicode thing works like magic.
The only thing I am still unable to do is to insert the symbol \epsilon (as distinct from \varepsilon).
For some reason, the varepsilon ε is printed fine, but a blank square is printed instead of the lunate epsilon ϵ.

That is u’ ε ’ works, while u’ ϵ’ does not.

Any idea why this is happening ?

Eli

2008/7/22 Michael Droettboom <mdroe@…86…>:

···

Yes, you would put it at the top of your .py file.

In order to use Unicode in Python source code, you have to tell the Python interpreter what encoding the file is in. That’s done with a little “magic” comment at the top of the file. The popular Unixy editors (emacs, vim etc.) also understand this comment and will save the file correctly. Possibly other editors do as well.

For more gory details that you probably need, see this:

http://www.amk.ca/python/howto/unicode

particularly the section “Unicode Literals in Python Source Code”.

Cheers,

Mike

Eli Brosh wrote:

Thanks,

This seems to be a solution.

I have an editor that supports unicode.

But, can you please explain better how do I make the coding directive at the top of my source files ?

Where do I write the command:

-- coding: utf-8 --

Is it inside the python script ?

Sorry for the ignorance.

Eli

On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom <mdroe@…86… mailto:mdroe@...86...> wrote:

As an alternative, you could just use Unicode to insert the Greek

characters:



r"α-Fe (Someone 2003)"



The default font used by matplotlib, Vera Sans, includes a full

set of Greek characters. This, of course, requires an editor that

supports Unicode and a coding directive at the top of your source

files, eg.:



# -*- coding: utf-8 -*-





Cheers,

Mike



Eli Brosh wrote:



    Here is the use case I have in mind:

    Plotting properties of various phases of iron, I need a legend

    with greek letters and normal text:

    \alpha-Fe, Someone (2003)



    Now, I need the names e.g. someone to be upright.

    Also, the relbar between \alpha and Fe is shorter with normal

    text fonts than with italics.



    I can solve the problem by using r'\rm{\alpha-Fe, Someone

    (2003)}' but it would be easier if I could just change the

    defaults.



    Eli





    On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom > >  > >         <mdroe@...86... <mailto:mdroe@...86...> > > <mailto:mdroe@...86... <mailto:mdroe@...86...>>> wrote:



       Unfortunately there isn't. This is *theoretically* possible

    with

       the STIX fonts, but that hasn't been implemented. However, with

       the Computer Modern fonts, many of the glyphs simply aren't

       present (upright Greek, for example) to make this happen.



       That said, I'm not sure this is necessarily a good idea.

    Math has

       a set of commonly accepted conventions about when to use italic

       vs. upright that may only confuse the reader when not followed.

       Can you provide a use case?



       Cheers,

       Mike



       Eli Brosh wrote:



           Hello

           I there a way to change the default mathtext font from

    cal to rm ?

           I would like to use the rm (serif) font without stating

           rm{...} or mathrm{...}.

           Is it possible to do using the matplotlibrc ?

           can you give me an example of how this is done ?



           Thanks

           Eli

                 ------------------------------------------------------------------------



                 -------------------------------------------------------------------------

           This SF.Net email is sponsored by the Moblin Your Move

           Developer's challenge

           Build the coolest Linux based applications with Moblin

    SDK &

           win great prizes

           Grand prize is a trip for two to an Open Source event

    anywhere

           in the world

                 [http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>

                 <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>>

                 ------------------------------------------------------------------------



           _______________________________________________

           Matplotlib-users mailing list

           Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>

           <mailto:Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>>



                 [https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)









--    Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA

Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA

(Sorry for the delay -- just back from vacation)

It looks like the default Vera Sans font that matplotlib uses doesn't actually have the lunate epsilon character. If you have it installed, you could have matplotlib use the DejaVu Sans font instead (which is essentially Vera Sans with a larger set of characters).

In your matplotlibrc, set font.sans to DejaVu Sans

Cheers,
Mike

Eli Brosh wrote:

···

Thanks,
This unicode thing works like magic.
The only thing I am still unable to do is to insert the symbol \epsilon (as distinct from \varepsilon).
For some reason, the varepsilon ε is printed fine, but a blank square is printed instead of the lunate epsilon ϵ.
That is u' ε ' works, while u' ϵ' does not.

Any idea why this is happening ?

Eli

2008/7/22 Michael Droettboom <mdroe@...86... <mailto:mdroe@…86…>>:

    Yes, you would put it at the top of your .py file.

    In order to use Unicode in Python source code, you have to tell
    the Python interpreter what encoding the file is in. That's done
    with a little "magic" comment at the top of the file. The popular
    Unixy editors (emacs, vim etc.) also understand this comment and
    will save the file correctly. Possibly other editors do as well.

    For more gory details that you probably need, see this:

    http://www.amk.ca/python/howto/unicode

    particularly the section "Unicode Literals in Python Source Code".

    Cheers,
    Mike

    Eli Brosh wrote:

        Thanks,
        This seems to be a solution.
        I have an editor that supports unicode.
        But, can you please explain better how do I make the coding
        directive at the top of my source files ?
        Where do I write the command:
        # -*- coding: utf-8 -*-

        Is it inside the python script ?

        Sorry for the ignorance.
        Eli

        On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom > <mdroe@...86... <mailto:mdroe@…86…> > <mailto:mdroe@…86…>> wrote:

           As an alternative, you could just use Unicode to insert the
        Greek
           characters:

           r"α-Fe (Someone 2003)"

           The default font used by matplotlib, Vera Sans, includes a full
           set of Greek characters. This, of course, requires an
        editor that
           supports Unicode and a coding directive at the top of your
        source
           files, eg.:

           # -*- coding: utf-8 -*-

           Cheers,
           Mike

           Eli Brosh wrote:

               Here is the use case I have in mind:
               Plotting properties of various phases of iron, I need a
        legend
               with greek letters and normal text:
               \alpha-Fe, Someone (2003)

               Now, I need the names e.g. someone to be upright.
               Also, the relbar between \alpha and Fe is shorter with
        normal
               text fonts than with italics.

               I can solve the problem by using r'\rm{\alpha-Fe, Someone
               (2003)}' but it would be easier if I could just change the
               defaults.

               Eli

               On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom > <mdroe@...86... <mailto:mdroe@…86…> > <mailto:mdroe@…86…> > <mailto:mdroe@…86… > <mailto:mdroe@…86…>>> wrote:

                  Unfortunately there isn't. This is *theoretically*
        possible
               with
                  the STIX fonts, but that hasn't been implemented.
        However, with
                  the Computer Modern fonts, many of the glyphs simply
        aren't
                  present (upright Greek, for example) to make this
        happen.

                  That said, I'm not sure this is necessarily a good idea.
               Math has
                  a set of commonly accepted conventions about when to
        use italic
                  vs. upright that may only confuse the reader when
        not followed.
                  Can you provide a use case?

                  Cheers,
                  Mike

                  Eli Brosh wrote:

                      Hello
                      I there a way to change the default mathtext
        font from
               cal to rm ?
                      I would like to use the rm (serif) font without
        stating
                      rm{...} or mathrm{...}.
                      Is it possible to do using the matplotlibrc ?
                      can you give me an example of how this is done ?

                      Thanks
                      Eli
                                   ------------------------------------------------------------------------

                                   -------------------------------------------------------------------------
                      This SF.Net email is sponsored by the Moblin
        Your Move
                      Developer's challenge
                      Build the coolest Linux based applications with
        Moblin
               SDK &
                      win great prizes
                      Grand prize is a trip for two to an Open Source
        event
               anywhere
                      in the world
                                   http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;
                      <http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;&gt;
                                   <http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;
                      <http://moblin-contest.org/redirect.php?banner_id=100&url=/
        <http://moblin-contest.org/redirect.php?banner_id=100&url=/&gt;&gt;&gt;
                                   ------------------------------------------------------------------------

                      _______________________________________________
                      Matplotlib-users mailing list
                      Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>
               <mailto:Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>>
                      <mailto:Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>
               <mailto:Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>>>

                                   matplotlib-users List Signup and Options

           -- Michael Droettboom
           Science Software Branch
           Operations and Engineering Division
           Space Telescope Science Institute
           Operated by AURA for NASA

    -- Michael Droettboom
    Science Software Branch
    Operations and Engineering Division
    Space Telescope Science Institute
    Operated by AURA for NASA

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thank you Michael,
I tried switching the matplotlib font to Dejavu Sans but it also does not seem to recognize the lunate epsilon ϵ.
When I wrote title(u’ϵ-Fe’), it printed ε-Fe instead.
I tried several other fonts but the problem did not disappear.

It seems that the bes choice after all is to write r’\rm{\epsilon-Fe}'.

Thanks again
Eli

···

On Thu, Jul 31, 2008 at 9:03 AM, Michael Droettboom <mdroe@…86…> wrote:

(Sorry for the delay – just back from vacation)

It looks like the default Vera Sans font that matplotlib uses doesn’t actually have the lunate epsilon character. If you have it installed, you could have matplotlib use the DejaVu Sans font instead (which is essentially Vera Sans with a larger set of characters).

In your matplotlibrc, set font.sans to DejaVu Sans

Cheers,

Mike

Eli Brosh wrote:

Thanks,

This unicode thing works like magic.

The only thing I am still unable to do is to insert the symbol \epsilon (as distinct from \varepsilon).

For some reason, the varepsilon ε is printed fine, but a blank square is printed instead of the lunate epsilon ϵ.

That is u’ ε ’ works, while u’ ϵ’ does not.

Any idea why this is happening ?

Eli

2008/7/22 Michael Droettboom <mdroe@…86… mailto:mdroe@...86...>:

Yes, you would put it at the top of your .py file.



In order to use Unicode in Python source code, you have to tell

the Python interpreter what encoding the file is in.  That's done

with a little "magic" comment at the top of the file.  The popular

Unixy editors (emacs, vim etc.) also understand this comment and

will save the file correctly.  Possibly other editors do as well.



For more gory details that you probably need, see this:



[http://www.amk.ca/python/howto/unicode](http://www.amk.ca/python/howto/unicode)



particularly the section "Unicode Literals in Python Source Code".





Cheers,

Mike



Eli Brosh wrote:



    Thanks,

    This seems to be a solution.

    I have an editor that supports unicode.

    But, can you please explain better how do I make the coding

    directive at the top of my source files ?

    Where do I write the command:

    # -*- coding: utf-8 -*-



    Is it inside the python script ?





    Sorry for the ignorance.

    Eli



    On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom > >  > >         <mdroe@...86... <mailto:mdroe@...86...> > > <mailto:mdroe@...86... <mailto:mdroe@...86...>>> wrote:



       As an alternative, you could just use Unicode to insert the

    Greek

       characters:



       r"α-Fe (Someone 2003)"



       The default font used by matplotlib, Vera Sans, includes a full

       set of Greek characters. This, of course, requires an

    editor that

       supports Unicode and a coding directive at the top of your

    source

       files, eg.:



       # -*- coding: utf-8 -*-





       Cheers,

       Mike



       Eli Brosh wrote:



           Here is the use case I have in mind:

           Plotting properties of various phases of iron, I need a

    legend

           with greek letters and normal text:

           \alpha-Fe, Someone (2003)



           Now, I need the names e.g. someone to be upright.

           Also, the relbar between \alpha and Fe is shorter with

    normal

           text fonts than with italics.



           I can solve the problem by using r'\rm{\alpha-Fe, Someone

           (2003)}' but it would be easier if I could just change the

           defaults.



           Eli





           On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom

           <mdroe@...86... <mailto:mdroe@...86...>

    <mailto:mdroe@...86... <mailto:mdroe@...86...>>

           <mailto:mdroe@...86... <mailto:mdroe@...86...>

    <mailto:mdroe@...86... <mailto:mdroe@...86...>>>> wrote:



              Unfortunately there isn't. This is *theoretically*

    possible

           with

              the STIX fonts, but that hasn't been implemented.

    However, with

              the Computer Modern fonts, many of the glyphs simply

    aren't

              present (upright Greek, for example) to make this

    happen.



              That said, I'm not sure this is necessarily a good idea.

           Math has

              a set of commonly accepted conventions about when to

    use italic

              vs. upright that may only confuse the reader when

    not followed.

              Can you provide a use case?



              Cheers,

              Mike



              Eli Brosh wrote:



                  Hello

                  I there a way to change the default mathtext

    font from

           cal to rm ?

                  I would like to use the rm (serif) font without

    stating

                  rm{...} or mathrm{...}.

                  Is it possible to do using the matplotlibrc ?

                  can you give me an example of how this is done ?



                  Thanks

                  Eli

                              ------------------------------------------------------------------------



                              -------------------------------------------------------------------------

                  This SF.Net email is sponsored by the Moblin

    Your Move

                  Developer's challenge

                  Build the coolest Linux based applications with

    Moblin

           SDK &

                  win great prizes

                  Grand prize is a trip for two to an Open Source

    event

           anywhere

                  in the world

                              [http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>

                 <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>>

                              <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>

                 <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)

    <[http://moblin-contest.org/redirect.php?banner_id=100&url=/](http://moblin-contest.org/redirect.php?banner_id=100&url=/)>>>

                              ------------------------------------------------------------------------



                  _______________________________________________

                  Matplotlib-users mailing list

                  Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>

           <mailto:Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>>

                  <mailto:Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>

           <mailto:Matplotlib-users@lists.sourceforge.net

    <mailto:Matplotlib-users@lists.sourceforge.net>>>



                              [https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)









       --    Michael Droettboom

       Science Software Branch

       Operations and Engineering Division

       Space Telescope Science Institute

       Operated by AURA for NASA







--    Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA

Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA