David wrote:
> Dear Mike, dear list,
>
> thanks for the continued help!
> Here are my 'news':
>
> On 18/03/10 22:22, Michael Droettboom wrote:
>>> import matplotlib
>>> matplotlib.use('GtkCairo')
>>>
>>> Incidentally, if I uncomment those two lines, then the (Western) font
>>> of my graph actually changes.
>> I'm completely stumped by this.
>
> Just now I couldn't reproduce this. However, the fonts in the png and 
> eps are quite different.
>
> When I run my dea.py with the attached matplotlibrc, then I get both a 
> png and an eps, however, the Chinese is still not rendered (see 
> attachments)
>
> I noticed the following in the ~rc:
> cairo.format      : png      # png, ps, pdf, svg
>
> But having it in or out makes no difference.
The Cairo backend is still not being selected.  By looking at the 
comments in the file, it's clear that the .eps file attached is being 
produced by the main matplotlib PS backend.

I think I've figured out what may be the problem.  The Cairo backend is 
not able to produce a .eps file, only a .ps (haven't investigated enough 
yet to determine if this is a shortcoming of Cairo itself or just the 
Cairo backend in matplotlib).  In any case, first confirm that you have 
the Cairo backend selected (which still doesn't seem to be working for 
you, and I'm not sure why).  See this page for more info on selecting 
backends:

http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

You can confirm you are using the Cairo backend by printing 
matplotlib.get_backend().

Once that's resolved, try saving a ".ps" file (not ".eps").  That should 
work.  You can always use ps2eps after the fact on this file.
>
>
> I
>> do see in the matplotlibrc that you attached that the "TkAgg" backend is
>> being specified, not "GtkCairo".
>
> I changed this now.
>>
>> I am able to get the Cairo backend to work just fine using matplotlib
>> 0.99.0. What version of cairo and pycairo do you have installed?
>
> python-cairo: 1.8.6-1ubuntu1
>
> In [15]: cairo.version
> Out[15]: '1.8.6'
>
>
> I wasn't able to find pycairo on my system (even after installing 
> python-cairo-dev). I belive pycairo and python-cairo are in fact the 
> same thing.
Yes, they are.  pycairo is the official name of the project.  
python-cairo is the name of the Ubuntu/Debian package for that project.
>
> Google found this:
>
> "Just for your info if your interested in programming with cairo on 
> ubuntu. I wanted to add svg, ps and pdf support to cairo (the ubuntu 
> packages don't support these cairo render backends yet.)"
> https://wiki.ubuntu.com/CairoPythonUbuntu
>
> Could this be the reason for my troubles (under Ubuntu)?
That seems to be very old.  Also, if that were the case, matplotlib 
would raise an exception like this: "cairo has not been compiled with PS 
support enabled".

>
>>>>> ps.fonttype=42
>>>>> pdf.fonttype=42
>>>
>>> I haven taken those out again, because I got an error message.
>> The error message may be related to using '=' rather than a ':'. In any
>> case, these settings don't affect by the Cairo backend so should have no
>> effect.
>
> I changed the = for a colon, yielding a nasty message:
>
> da...@ubuntu:~/Documents/PhD/Dissertation/LaTeX/figures$ python dea.py
> /usr/lib/pymodules/python2.6/matplotlib/__init__.py:653: UserWarning: 
> Duplicate key in file "/etc/matplotlibrc", line #329
>   warnings.warn('Duplicate key in file "%s", line #%d'%(fname,cnt))
That means exactly what it says: you have the same setting appearing 
more than once in the file.  Each setting can only appear at most once.  
But again, these settings are not used by the Cairo backend, so are 
irrelevant to the solution at hand.

Hope this helps.

Mike
>
> Hopefully we will get to the bottom of this! I am sorry to bother you 
> with all this -- and appreciate your efforts!
>
> Greeting from Beijing,
>
> David
>
>
>
>
>
> ------------------------------------------------------------------------
>

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


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to