Hi,

I am trying to make plots by using matplotlib.pyplot (within a Python
script) to be used in a web site (apache, and PHP). I am using Ubuntu
12.04.3. The script works fine when run from the command line (it is able to
generate the image with "savefig"), but when the script doesn't work when
run from PHP under an apache request. I have found a similar problem in this
post:
http://matplotlib.1069221.n5.nabble.com/savefig-fails-under-apache-on-solaris-td15122.html

Finally, I have found the solution in this web:
http://texnological.blogspot.com.es/2013/01/how-to-execute-python-matplolib-pylab.html

The solution consists on importing matplotlib in this way:
  # To import pylab
  os.environ[ 'MPLCONFIGDIR' ] = '/tmp/'
  import matplotlib
  matplotlib.use('agg')
  import pylab

This works for me, but I don't know whether this is a bug and it has to be
reported anywhere. The best option should be to import it in a regular way
(such as import matplotlib.pyplot as plt), and this can be confusing for a
lot of people. Well, let me know. Thank you.

Best regards,

Jilguero.







--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/images-for-web-sites-tp42581.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to