Missing labels/text(s) in plots generated via cgi script.

I’m using the code from http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_script to generate plots from my web server. The plot shows up fine (w/o text) but when I use xlabel(“x-axis”), ylabel(“y-axis”), or title(“A Chart”); no text shows up on the plot. Everything seems fine with the install and I don’t get any errors when I run the script. It seems that that matplotlib is unable to find the font’s and just simply ignores them – I really dunno.

Any suggestions?

Can you set "verbose.level" to "debug-annoying" in your matplotlibrc and send us the output? That may help provide an explanation as to why the text is not appearing. Also, for good measure, can you provide your matplotlibrc file, and information about the platform and versions of Python that you are using? Do you get different results when you run at the commandline vs. from an http request? It could be that incorrect permissions (as user "apache", for instance) are causing the problems.

Cheers,
Mike

Tim Lewis wrote:

···

I'm using the code from http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_script to generate plots from my web server. The plot shows up fine (w/o text) but when I use xlabel("x-axis"), ylabel("y-axis"), or title("A Chart"); no text shows up on the plot. Everything seems fine with the install and I don't get any errors when I run the script. It seems that that matplotlib is unable to find the font's and just simply ignores them -- I really dunno.

Any suggestions?

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

-------------------------------------------------------------------------
SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

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

_______________________________________________
Matplotlib-users mailing list
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

Can you set "verbose.level" to "debug-annoying" in your matplotlibrc and
send us the output? That may help provide an explanation as to why the
text is not appearing. Also, for good measure, can you provide your
matplotlibrc file, and information about the platform and versions of
Python that you are using?

See the attachments. Their platform is RedHat Linux and python 2.4.3

Do you get different results when you run at
the commandline vs. from an http request? It could be that incorrect
permissions (as user "apache", for instance) are causing the problems.

Cheers,
Mike

I'd like to run it from the command line, but I haven't done it before
(and not sure how to do it); the web hosting server is in a land far
far away. :slight_smile: I am just running the script from a http request. I
can probably have them run it if need to.

Thanks,

cgi-plot.log.txt (14.9 KB)

matplotlibrc.txt (14 KB)

···

Tim Lewis wrote:

I'm using the code from
http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_script
to generate plots from my web server. The plot shows up fine (w/o text)
but when I use xlabel("x-axis"), ylabel("y-axis"), or title("A Chart");
no text shows up on the plot. Everything seems fine with the install
and I don't get any errors when I run the script. It seems that that
matplotlib is unable to find the font's and just simply ignores them --
I really dunno.

Any suggestions?

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

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

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

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

It appears to be finding "wadalab-gothic" as the font, which is a Japanese font. Now, *why* it is doing that is the million dollar question.

It should (by default) by loading the Bitstream Vera Sans font (Vera.ttf) from /usr/local/lib/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf. I would verify that it is there and readable by the "user" that the CGI script runs under. You can try refreshing the font-finding cache by removing the file ~/.matplotlib/fontManager.cache.

If that doesn't provide any clues, can you send me the fontManager.cache (probably best off-list), and I'll see what fonts it *is* finding, again hopefully providing more clues.

One other thing to note about the output: it is loading the matplotlibrc from /home/www/www/cgi-bin/, (since it is present), and not from /home/private/mpl/.matplotlib/. Perhaps there is something incorrect in that matplotlibrc file.

Cheers,
Mike

Tim Lewis wrote:

···

Can you set "verbose.level" to "debug-annoying" in your matplotlibrc and send us the output? That may help provide an explanation as to why the text is not appearing. Also, for good measure, can you provide your matplotlibrc file, and information about the platform and versions of Python that you are using?

See the attachments. Their platform is RedHat Linux and python 2.4.3

Do you get different results when you run at the commandline vs. from an http request? It could be that incorrect permissions (as user "apache", for instance) are causing the problems.

Cheers,
Mike

I'd like to run it from the command line, but I haven't done it before
(and not sure how to do it); the web hosting server is in a land far
far away. :slight_smile: I am just running the script from a http request. I
can probably have them run it if need to.

Thanks,

Tim Lewis wrote:

I'm using the code from http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_script to generate plots from my web server. The plot shows up fine (w/o text) but when I use xlabel("x-axis"), ylabel("y-axis"), or title("A Chart"); no text shows up on the plot. Everything seems fine with the install and I don't get any errors when I run the script. It seems that that matplotlib is unable to find the font's and just simply ignores them -- I really dunno.

Any suggestions?

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

-------------------------------------------------------------------------
SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

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

_______________________________________________
Matplotlib-users mailing list
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

It appears to be finding "wadalab-gothic" as the font, which is a
Japanese font. Now, *why* it is doing that is the million dollar question.

It should (by default) by loading the Bitstream Vera Sans font
(Vera.ttf) from
/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf. I
would verify that it is there and readable by the "user" that the CGI
script runs under. You can try refreshing the font-finding cache by
removing the file ~/.matplotlib/fontManager.cache.

If that doesn't provide any clues, can you send me the fontManager.cache
(probably best off-list), and I'll see what fonts it *is* finding, again
  hopefully providing more clues.

One other thing to note about the output: it is loading the matplotlibrc
from /home/www/www/cgi-bin/, (since it is present), and not from
/home/private/mpl/.matplotlib/. Perhaps there is something incorrect in
that matplotlibrc file.

The matplotlibrc file was basically using all defaults. Have you tried
deleting your site-packages/matplotlib* and the build/ directory from your
mpl sources, and reinstalling?

Darren

···

On Monday 10 December 2007 8:21:03 am Michael Droettboom wrote:

Tim Lewis wrote:
>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc and
>> send us the output? That may help provide an explanation as to why the
>> text is not appearing. Also, for good measure, can you provide your
>> matplotlibrc file, and information about the platform and versions of
>> Python that you are using?
>
> See the attachments. Their platform is RedHat Linux and python 2.4.3
>
>> Do you get different results when you run at
>> the commandline vs. from an http request? It could be that incorrect
>> permissions (as user "apache", for instance) are causing the problems.
>>
>> Cheers,
>> Mike
>
> I'd like to run it from the command line, but I haven't done it before
> (and not sure how to do it); the web hosting server is in a land far
> far away. :slight_smile: I am just running the script from a http request. I
> can probably have them run it if need to.
>
> Thanks,
>
>> Tim Lewis wrote:
>>> I'm using the code from
>>> http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_scri
>>>pt to generate plots from my web server. The plot shows up fine (w/o
>>> text) but when I use xlabel("x-axis"), ylabel("y-axis"), or title("A
>>> Chart"); no text shows up on the plot. Everything seems fine with the
>>> install and I don't get any errors when I run the script. It seems
>>> that that matplotlib is unable to find the font's and just simply
>>> ignores them -- I really dunno.
>>>
>>> Any suggestions?

I deleted my /.matplotlib/fontManager.cache file and ran the script
again, and now everything is working fine.

Thank you for your help.

···

It appears to be finding "wadalab-gothic" as the font, which is a
Japanese font. Now, *why* it is doing that is the million dollar question.

It should (by default) by loading the Bitstream Vera Sans font
(Vera.ttf) from
/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf. I
would verify that it is there and readable by the "user" that the CGI
script runs under. You can try refreshing the font-finding cache by
removing the file ~/.matplotlib/fontManager.cache.

If that doesn't provide any clues, can you send me the fontManager.cache
(probably best off-list), and I'll see what fonts it *is* finding, again
hopefully providing more clues.

One other thing to note about the output: it is loading the matplotlibrc
from /home/www/www/cgi-bin/, (since it is present), and not from
/home/private/mpl/.matplotlib/. Perhaps there is something incorrect in
that matplotlibrc file.

Cheers,
Mike

Tim Lewis wrote:

Can you set "verbose.level" to "debug-annoying" in your matplotlibrc and
send us the output? That may help provide an explanation as to why the
text is not appearing. Also, for good measure, can you provide your
matplotlibrc file, and information about the platform and versions of
Python that you are using?

See the attachments. Their platform is RedHat Linux and python 2.4.3

Do you get different results when you run at
the commandline vs. from an http request? It could be that incorrect
permissions (as user "apache", for instance) are causing the problems.

Cheers,
Mike

I'd like to run it from the command line, but I haven't done it before
(and not sure how to do it); the web hosting server is in a land far
far away. :slight_smile: I am just running the script from a http request. I
can probably have them run it if need to.

Thanks,

Tim Lewis wrote:

I'm using the code from
http://www.scipy.org/Cookbook/Matplotlib/Using_MatPlotLib_in_a_CGI_script
to generate plots from my web server. The plot shows up fine (w/o text)
but when I use xlabel("x-axis"), ylabel("y-axis"), or title("A Chart");
no text shows up on the plot. Everything seems fine with the install
and I don't get any errors when I run the script. It seems that that
matplotlib is unable to find the font's and just simply ignores them --
I really dunno.

Any suggestions?

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

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

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

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