How to save text in vector images as text rather than paths?

I’m creating charts in matplotlib and saving them using savefig(‘chart.eps’). How can I make the labels actually be text rather than paths, which seems to be the default? (when I open the .eps files in Illustrator, I can’t edit them as text)

I’m using the latest matplotlib and python on Windows XP.

Thanks

Eliss

I'm creating charts in matplotlib and saving them using
savefig('chart.eps'). How can I make the labels actually be text rather
than paths, which seems to be the default? (when I open the .eps files
in Illustrator, I can't edit them as text)

When you say "labels", are you referring to the tick labels?

If so, near the top of your script, try:

import matplotlib
matplotlib.rcParams['axes.unicode_minus'] = False

Otherwise all tick labels are treated as unicode by default, and unicode is rendered in the ps backend as a sequence of glyphs rather than as a single text string.

You might also consider using matplotlib to write pdf files instead of ps. The eps format is older and more limited in its capabilities than pdf. You can always convert pdf to eps as a last step, if eps is what you ultimately need. I've never used Illustrator, but I presume it can happily import pdf and export eps.

Eric

···

On 06/27/2010 08:06 AM, Eliss Parke wrote:

I'm using the latest matplotlib and python on Windows XP.

Thanks
Eliss

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

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

Just to note, in Linux, one can use the pdf2ps command. I believe Windows users can use GhostScript to convert a pdf into an eps file rather than using Illustrator for a simple conversion process.

Ben Root

···

On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing <efiring@…202…> wrote:

On 06/27/2010 08:06 AM, Eliss Parke wrote:

I’m creating charts in matplotlib and saving them using

savefig(‘chart.eps’). How can I make the labels actually be text rather

than paths, which seems to be the default? (when I open the .eps files

in Illustrator, I can’t edit them as text)

When you say “labels”, are you referring to the tick labels?

If so, near the top of your script, try:

import matplotlib

matplotlib.rcParams[‘axes.unicode_minus’] = False

Otherwise all tick labels are treated as unicode by default, and unicode

is rendered in the ps backend as a sequence of glyphs rather than as a

single text string.

You might also consider using matplotlib to write pdf files instead of

ps. The eps format is older and more limited in its capabilities than

pdf. You can always convert pdf to eps as a last step, if eps is what

you ultimately need. I’ve never used Illustrator, but I presume it can

happily import pdf and export eps.

Eric

I’m using the latest matplotlib and python on Windows XP.

Thanks

Eliss


This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/firsthttp://p.sf.net/sfu/sprint-com-first


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/firsthttp://p.sf.net/sfu/sprint-com-first


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Just to note, in Linux, one can use the pdf2ps command. I believe

I recommend the pdftops command if you have it, instead of pdf2ps. At least on my system (ubuntu 10.04), pdf2ps seems to be embedding coarse bit-mapped versions of the fonts. The output looks pretty bad.

Eric

···

On 06/28/2010 04:30 AM, Benjamin Root wrote:

Windows users can use GhostScript to convert a pdf into an eps file
rather than using Illustrator for a simple conversion process.

Ben Root

On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing <efiring@…202… > <mailto:efiring@…202…>> wrote:

    On 06/27/2010 08:06 AM, Eliss Parke wrote:
     > I'm creating charts in matplotlib and saving them using
     > savefig('chart.eps'). How can I make the labels actually be text
    rather
     > than paths, which seems to be the default? (when I open the .eps
    files
     > in Illustrator, I can't edit them as text)

    When you say "labels", are you referring to the tick labels?

    If so, near the top of your script, try:

    import matplotlib
    matplotlib.rcParams['axes.unicode_minus'] = False

    Otherwise all tick labels are treated as unicode by default, and unicode
    is rendered in the ps backend as a sequence of glyphs rather than as a
    single text string.

    You might also consider using matplotlib to write pdf files instead of
    ps. The eps format is older and more limited in its capabilities than
    pdf. You can always convert pdf to eps as a last step, if eps is what
    you ultimately need. I've never used Illustrator, but I presume it can
    happily import pdf and export eps.

    Eric

     >
     > I'm using the latest matplotlib and python on Windows XP.
     >
     > Thanks
     > Eliss
     >
    ------------------------------------------------------------------------------
     > This SF.net email is sponsored by Sprint
     > What will you do first with EVO, the first 4G phone?
     > Visit sprint.com/first <http://sprint.com/first> --
    http://p.sf.net/sfu/sprint-com-first
     >
     > _______________________________________________
     > Matplotlib-users mailing list
     > Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
     > https://lists.sourceforge.net/lists/listinfo/matplotlib-users

    ------------------------------------------------------------------------------
    This SF.net email is sponsored by Sprint
    What will you do first with EVO, the first 4G phone?
    Visit sprint.com/first <http://sprint.com/first> --
    http://p.sf.net/sfu/sprint-com-first
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

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

Hmm, there is definitely a difference in qualiity. Thanks for the tip!/

Ben Root

···

On Mon, Jun 28, 2010 at 11:46 AM, Eric Firing <efiring@…202…> wrote:

On 06/28/2010 04:30 AM, Benjamin Root wrote:

Just to note, in Linux, one can use the pdf2ps command. I believe

I recommend the pdftops command if you have it, instead of pdf2ps. At

least on my system (ubuntu 10.04), pdf2ps seems to be embedding coarse

bit-mapped versions of the fonts. The output looks pretty bad.

Eric

Windows users can use GhostScript to convert a pdf into an eps file

rather than using Illustrator for a simple conversion process.

Ben Root

On Sun, Jun 27, 2010 at 2:12 PM, Eric Firing <efiring@…202… > > mailto:efiring@...202...> wrote:

On 06/27/2010 08:06 AM, Eliss Parke wrote:
 > I'm creating charts in matplotlib and saving them using
 > savefig('chart.eps'). How can I make the labels actually be text
rather
 > than paths, which seems to be the default? (when I open the .eps
files
 > in Illustrator, I can't edit them as text)
When you say "labels", are you referring to the tick labels?
If so, near the top of your script, try:
import matplotlib
matplotlib.rcParams['axes.unicode_minus'] = False
Otherwise all tick labels are treated as unicode by default, and unicode
is rendered in the ps backend as a sequence of glyphs rather than as a
single text string.
You might also consider using matplotlib to write pdf files instead of
ps.  The eps format is older and more limited in its capabilities than
pdf.  You can always convert pdf to eps as a last step, if eps is what
you ultimately need.  I've never used Illustrator, but I presume it can
happily import pdf and export eps.
Eric
 >
 > I'm using the latest matplotlib and python on Windows XP.
 >
 > Thanks
 > Eliss
 >
 >
 >
 >
------------------------------------------------------------------------------
 > This SF.net email is sponsored by Sprint
 > What will you do first with EVO, the first 4G phone?
 > Visit [sprint.com/first](http://sprint.com/first) <[http://sprint.com/first](http://sprint.com/first)> --
[http://p.sf.net/sfu/sprint-com-first](http://p.sf.net/sfu/sprint-com-first)
 >
 >
 >
 > _______________________________________________
 > 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)
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit [sprint.com/first](http://sprint.com/first) <[http://sprint.com/first](http://sprint.com/first)> --
[http://p.sf.net/sfu/sprint-com-first](http://p.sf.net/sfu/sprint-com-first)
_______________________________________________
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)

This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/firsthttp://p.sf.net/sfu/sprint-com-first


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/firsthttp://p.sf.net/sfu/sprint-com-first


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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