problems with fonts

Hi all,

I’m trying to use matplotlib to generate some graphs on a webpage for me. Everything works pretty well, except, I cannot make a change to the fonts. I’ve set up the scripts to be called as a cgi script or to be run from the command line. When I run them from the command line, I get the correct font (Arial) yet when run from the web page, it uses the CMR10 font. Arial is installed on the linux system.

I’ve thought the problem might be related to which matplotlibrc file each script might be using, but when I check matplotlib.matplotlib_fname() from the command line and web page, they return the same.

Maybe there is a way to get the --verbose-debug output when run from a web page? That could help me figure out what’s going on.

I know I could manually specify the font using font_manager, but that’s not really ideal as I’d have to do it manually for each graph. I’d rather have a global solution for all my graphs. Any help is greatly appreciated.

robbie

When run as the web server, it’s probably running as a different user.
Is Arial installed in ~/.fonts? If so the webserver user won’t find it.

Hi all,

I’m trying to use matplotlib to generate some graphs on a
webpage for me. Everything works pretty well, except, I cannot make a
change to the fonts. I’ve set up the scripts to be called as a cgi
script or to be run from the command line. When I run them from the
command line, I get the correct font (Arial) yet when run from the web
page, it uses the CMR10 font. Arial is installed on the linux system.

I’ve thought the problem might be related to which matplotlibrc
file each script might be using, but when I
check matplotlib.matplotlib_fname() from the command line and web page,
they return the same.

Maybe there is a way to get the --verbose-debug output when run
from a web page? That could help me figure out what’s going on.

You can set “verbose.level” to “debug-annoying” in your matplotlibrc.
If the webserver is collecting standard output, the debug messages
should end up in the web server logs.

I know I could manually specify the font using font_manager, but
that’s not really ideal as I’d have to do it manually for each graph.
I’d rather have a global solution for all my graphs. Any help is
greatly appreciated.

Cheers,

Mike

···

http://p.sf.net/sfu/ms-webmatrix-sf


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

Hi,

Fixed it by deleting fontList.cache in my tmp directory that was being used by the web server.

Maybe this helps someone else.

···

On Mon, Apr 4, 2011 at 3:29 PM, Michael Droettboom <mdroe@…86…> wrote:

When run as the web server, it’s probably running as a different user.
Is Arial installed in ~/.fonts? If so the webserver user won’t find it.

On 04/04/2011 03:17 PM, Robbie Edwards wrote:

Hi all,

I’m trying to use matplotlib to generate some graphs on a
webpage for me. Everything works pretty well, except, I cannot make a
change to the fonts. I’ve set up the scripts to be called as a cgi
script or to be run from the command line. When I run them from the
command line, I get the correct font (Arial) yet when run from the web
page, it uses the CMR10 font. Arial is installed on the linux system.

I’ve thought the problem might be related to which matplotlibrc
file each script might be using, but when I
check matplotlib.matplotlib_fname() from the command line and web page,
they return the same.

Maybe there is a way to get the --verbose-debug output when run
from a web page? That could help me figure out what’s going on.

You can set “verbose.level” to “debug-annoying” in your matplotlibrc.
If the webserver is collecting standard output, the debug messages
should end up in the web server logs.

I know I could manually specify the font using font_manager, but
that’s not really ideal as I’d have to do it manually for each graph.
I’d rather have a global solution for all my graphs. Any help is
greatly appreciated.

Cheers,

Mike

robbie



Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf



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

-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

Xperia™ PLAY

It’s a major breakthrough. An authentic gaming

smartphone on the nation’s most reliable network.

And it wants your games.

http://p.sf.net/sfu/verizon-sfdev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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