[Matplotlib-users] Running matplotlib job with cron

2009-06-25 Thread Paul Simon
I've written my first python script with matplotlib, which works fine at the 
command line but not with cron.  It's quite puzzling to me, and probably 
involves some path declaration that I don't know about.

#plot data from automate.csv
import matplotlib
import datetime
import numpy
from matplotlib import legend
from matplotlib.pyplot import figure, show, plot_date, setp, ylabel, savefig, 
xlabel
from matplotlib.dates import DayLocator, HourLocator, DateLocator, 
DateFormatter,drange, MinuteLocator, date2num, num2date
from matplotlib.mlab import csv2rec
from matplotlib.ticker import *
newr = csv2rec('/home/paulsimon/Documents/automate.csv')
x = date2num(newr.field(0))
fig = figure()
ax1 = fig.add_subplot(111)
line1, = ax1.plot_date(newr['dattim'], newr['bench_1'], '-r',label = 'bench 1')
line2, = ax1.plot_date(newr['dattim'], newr['bench_2'], '-b', label = 'bench 2')
line3, = ax1.plot_date(newr['dattim'], newr['eave'],'-k', label = 'eave')
line4, = ax1.plot_date(newr['dattim'], newr['outside'], '-g', label = 'outside')

ylabel('temperature')
xlabel(r'time/date')
hours = HourLocator(range(0,26,4))

dateformatter = DateFormatter('%I:%M %p\n%m/%d/%y')
ax1.xaxis.set_major_formatter(dateformatter)
ax1.xaxis.set_major_locator(hours)
ax1.set_ylim(30,100)
# Rotate x labels
for label in ax1.xaxis.get_ticklabels():
label.set_fontsize(8)

ax1.grid(True)
ax1.xaxis.grid(False)
yminorLocator = MultipleLocator(5)
ax1.yaxis.set_minor_locator(yminorLocator)
ax1.yaxis.grid(True,which='major', linestyle ='-')
ax1.yaxis.grid(True,which='minor',linestyle = ':')
leg = ax1.legend(('bench 1', 'bench 2', ' eave',  'outside'), 'lower right', 
shadow = True)
for t in leg.get_texts():
t.set_fontsize('small')

savefig('/home/paulsimon/python_scripts/image.png', format = 'png')


Running with --debug option, here are the two different output files:

$HOME=/home/paulsimon
CONFIGDIR=/home/paulsimon/.matplotlib
matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file /usr/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 0.91.2
verbose.level debug
interactive is False
units is False
platform is linux2
loaded modules: ['_bisect', 'xml.sax.urlparse', 'distutils', 
'matplotlib.matplotlib', 'datetime', 'matplotlib.tempfile', 
'distutils.sysconfig', 'encodings.encodings', 'pytz.cStringIO', 'xml', 
'distutils.dep_util', 'struct', 'tempfile', 'xml.sax.urllib', 'imp', '_struct', 
'pytz.os', 'zipimport', 'string', 'encodings.utf_8', 'matplotlib.__future__', 
'pytz.tzinfo', 'pytz.datetime', 'distutils.re', 'bisect', 'signal', 'random', 
'xml.sax.xmlreader', 'matplotlib.pytz', 'distutils.log', 'pytz.tzfile', 
'cStringIO', 'pkgutil', 'locale', 'xml.sax.saxutils', 'encodings', 'dateutil', 
'matplotlib.warnings', 'matplotlib.string', 'pytz.pytz', 'urllib', 
'matplotlib.sys', 're', 'new', 'math', 'fcntl', 'UserDict', 'distutils.os', 
'matplotlib', 'codecs', 'md5', '_locale', 'matplotlib.sre_constants', 
'matplotlib.os', 'thread', 'pkg_resources', 'weakref', 'itertools', 
'distutils.spawn', 'distutils.sys', 'os', 'sre_parse', '__future__', 
'matplotlib.copy', 'xml.sax.types', '_sre', '__builtin__', 'matplotlib.re', 
'operator', 'distutils.util', 'distutils.string', 'matplotlib.datetime', 
'posixpath', 'errno', '_socket', 'binascii', 'sre_constants', 'matplotlib.md5', 
'types', 'pytz.sys', 'xml.sax.handler', 'pytz.pkg_resources', 'xml.sax.os', 
'matplotlib.xml', '_codecs', 'pytz', 'matplotlib.pyparsing', 'copy', 'socket', 
'_types', 'matplotlib.dateutil', 'hashlib', 'posix', 'encodings.aliases', 
'matplotlib.fontconfig_pattern', 'exceptions', 'xml.sax._exceptions', 
'pytz.bisect', 'distutils.distutils', 'copy_reg', 'sre_compile', 'xml.sax', 
'_hashlib', '_random', 'pytz.struct', 'site', '__main__', 'shutil', 
'matplotlib.weakref', 'strop', 'encodings.codecs', 'gettext', 
'matplotlib.rcsetup', 'pytz.sets', 'xml.sax.codecs', 'stat', '_ssl', 
'warnings', 'encodings.types', 'sets', 'sys', 'xml.sax.sys', 'os.path', 
'pytz.gettext', 'matplotlib.distutils', '_weakref', 'distutils.errors', 
'urlparse', 'linecache', 'matplotlib.shutil', 'time']
Using fontManager instance from /home/paulsimon/.matplotlib/fontManager.cache
numerix numpy 1.0.4
backend GTKAgg version 2.12.1
 findfont found Bitstream Vera Sans, normal, normal 400, normal, 8.0
findfont returning 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
 findfont found Bitstream Vera Sans, normal, normal 400, normal, 8.0
findfont returning 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
 findfont found Bitstream Vera Sans, normal, normal 400, normal, 8.0

... 


findfont returning 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
 findfont found Bitstream Vera Sans, normal, normal 400, normal, 9.996
findfont returning 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf

And this is the output file (complete) running under cron:


Re: [Matplotlib-users] hexbin extent Attribute Error

2009-06-25 Thread Alexandar Hansen
Does this code work for anyone else?


import numpy as np
import matplotlib.cm as cm
import  matplotlib.pyplot as plt

n = 10
x = np.random.standard_normal(n)
y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
xmin = x.min()
xmax = x.max()
ymin = y.min()
ymax = y.max()

plt.hexbin(x,y, cmap=cm.jet, gridsize=(50,50), extent=[-2,2,-10,10])
plt.axis([xmin, xmax, ymin, ymax])
plt.title(Hexagon binning)
cb = plt.colorbar()
cb.set_label('counts')

plt.show()


Without the extent option, I get the expected plot of all the data. But,
what I'd like is to trim out some of the empty regions. If I just reset
xmin, xmax, etc. the binning of the data still occurs over the entire range
of the data in x and y, although the plot is correct, but the plot doesn't
have the desired 50x50 bins. With the extent option I get these errors:


Traceback (most recent call last):
  File HexBin.py, line 23, in module
plt.hexbin(x,y, cmap=cm.jet, extent=[-2,2,-10,10])
  File /usr/lib64/python2.5/site-packages/matplotlib/pyplot.py, line 1920,
in hexbin
ret =  gca().hexbin(*args, **kwargs)
  File /usr/lib64/python2.5/site-packages/matplotlib/axes.py, line 5447,
in hexbin
collection.update(kwargs)
  File /usr/lib64/python2.5/site-packages/matplotlib/artist.py, line 548,
in update
raise AttributeError('Unknown property %s'%k)
AttributeError: Unknown property extent


Best,
Alex



On Thu, Jun 18, 2009 at 11:27 AM, Alexandar Hansen viochem...@gmail.comwrote:

 Ok, fair enough. Let's use that:

 --
 import numpy as np
 import matplotlib.cm as cm
 import  matplotlib.pyplot as plt

 n = 10
 x = np.random.standard_normal(n)
 y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
 xmin = x.min()
 xmax = x.max()
 ymin = y.min()
 ymax = y.max()

 plt.hexbin(x,y, cmap=cm.jet, gridsize=(50,50), extent=[-2,2,-10,10])
 plt.axis([xmin, xmax, ymin, ymax])
 plt.title(Hexagon binning)
 cb = plt.colorbar()
 cb.set_label('counts')


 plt.show()
 --


 I trimmed this from the example, which works fine.  Without the extent
 option, I get the expected plot of all the data. But, what I'd like is to
 trim out some of the empty regions. If I just reset xmin, xmax, etc. the
 binning of the data still occurs over the entire range of the data in x and
 y, although the plot is correct, but the plot doesn't have the desired 50x50
 bins. With the extent option I get these errors:


 Traceback (most recent call last):
   File HexBin.py, line 23, in module
 plt.hexbin(x,y, cmap=cm.jet, extent=[-2,2,-10,10])
   File /usr/lib64/python2.5/site-packages/matplotlib/pyplot.py, line
 1920, in hexbin
 ret =  gca().hexbin(*args, **kwargs)
   File /usr/lib64/python2.5/site-packages/matplotlib/axes.py, line 5447,
 in hexbin
 collection.update(kwargs)
   File /usr/lib64/python2.5/site-packages/matplotlib/artist.py, line 548,
 in update
 raise AttributeError('Unknown property %s'%k)
 AttributeError: Unknown property extent


 The same thing as before. It doesn't know what 'extent' is for some reason.
 Or, perhaps more accurately, hexbin knows what it is but artist.py doesn't?
 The only solution i've come up with is to trim the original data that I
 input, but that is far from ideal.


 Best,

 Alex







 On Wed, Jun 17, 2009 at 7:50 PM, John Hunter jdh2...@gmail.com wrote:

 On Wed, Jun 17, 2009 at 5:31 PM, Alexandar Hansenviochem...@gmail.com
 wrote:
  Hello,
 
  I've been having fun using hexbin, but I'd like to have consistent bin
 sizes
  and plot ranges for different sets of data. What I'm finding is that the
 bin
  sizes are primarily determined by the input data mins and maxes. For
  instance, I'm plotting data with something like:

 Instead of a something like could you please post a complete example
 that we can run so we can replicate the error.  This saves us a lot of
 time.  Also, please report any version info, as described at


 http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem

 For example, the following runs for me using mpl svn:

 import numpy as np
 import matplotlib.cm as cm
 import  matplotlib.pyplot as plt

 n = 10
 x = np.random.standard_normal(n)
 y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
 xmin = x.min()
 xmax = x.max()
 ymin = y.min()
 ymax = y.max()

 plt.subplots_adjust(hspace=0.5)
 plt.subplot(121)
 plt.hexbin(x,y, cmap=cm.jet, extent=[xmin, xmax, ymin, ymax])
 plt.axis([xmin, xmax, ymin, ymax])
 plt.title(Hexagon binning)
 cb = plt.colorbar()
 cb.set_label('counts')

 plt.subplot(122)
 plt.hexbin(x,y,bins='log', cmap=cm.jet)
 plt.axis([xmin, xmax, ymin, ymax])
 plt.title(With a log color scale)
 cb = plt.colorbar()
 cb.set_label('log10(N)')

 plt.show()



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


Re: [Matplotlib-users] Running matplotlib job with cron

2009-06-25 Thread Sandro Tosi
Hello Paul,

On Thu, Jun 25, 2009 at 19:13, Paul Simonpsi...@sonic.net wrote:
 I've written my first python script with matplotlib, which works fine at the
 command line but not with cron.  It's quite puzzling to me, and probably
 involves some path declaration that I don't know about.

I may have read the mail fast, but I can't see any notice about if the
image outputs are different (other than the textual outputs).

 matplotlib version 0.91.2

You might also want to update: matplotlib latest release is 0.98.5.3

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

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


[Matplotlib-users] [Fwd: Re: Running matplotlib job with cron]

2009-06-25 Thread Michael Droettboom


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

---BeginMessage---
You'll want to use the Agg backend, since the GtkAgg backend will try to 
open a window (which isn't generally possible from a cron job).


Put:

import matplotlib
matplotlib.use['Agg']

at the top of your script.

Mike

Paul Simon wrote:
I've written my first python script with matplotlib, which works fine 
at the command line but not with cron.  It's quite puzzling to me, and 
probably involves some path declaration that I don't know about.
 
#plot data from automate.csv

import matplotlib
import datetime
import numpy
from matplotlib import legend
from matplotlib.pyplot import figure, show, plot_date, setp, ylabel, 
savefig, xlabel
from matplotlib.dates import DayLocator, HourLocator, DateLocator, 
DateFormatter,drange, MinuteLocator, date2num, num2date

from matplotlib.mlab import csv2rec
from matplotlib.ticker import *
newr = csv2rec('/home/paulsimon/Documents/automate.csv')
x = date2num(newr.field(0))
fig = figure()
ax1 = fig.add_subplot(111)
line1, = ax1.plot_date(newr['dattim'], newr['bench_1'], '-r',label = 
'bench 1')
line2, = ax1.plot_date(newr['dattim'], newr['bench_2'], '-b', label = 
'bench 2')

line3, = ax1.plot_date(newr['dattim'], newr['eave'],'-k', label = 'eave')
line4, = ax1.plot_date(newr['dattim'], newr['outside'], '-g', label = 
'outside')
 
ylabel('temperature')

xlabel(r'time/date')
hours = HourLocator(range(0,26,4))
 
dateformatter = DateFormatter('%I:%M %p\n%m/%d/%y')

ax1.xaxis.set_major_formatter(dateformatter)
ax1.xaxis.set_major_locator(hours)
ax1.set_ylim(30,100)
# Rotate x labels
for label in ax1.xaxis.get_ticklabels():
label.set_fontsize(8)
 
ax1.grid(True)

ax1.xaxis.grid(False)
yminorLocator = MultipleLocator(5)
ax1.yaxis.set_minor_locator(yminorLocator)
ax1.yaxis.grid(True,which='major', linestyle ='-')
ax1.yaxis.grid(True,which='minor',linestyle = ':')
leg = ax1.legend(('bench 1', 'bench 2', ' eave',  'outside'), 'lower 
right', shadow = True)

for t in leg.get_texts():
t.set_fontsize('small')
   
savefig('/home/paulsimon/python_scripts/image.png', format = 'png')
 


Running with --debug option, here are the two different output files:
 
$HOME=/home/paulsimon

CONFIGDIR=/home/paulsimon/.matplotlib
matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc

matplotlib version 0.91.2
verbose.level debug
interactive is False
units is False
platform is linux2
loaded modules: ['_bisect', 'xml.sax.urlparse', 'distutils', 
'matplotlib.matplotlib', 'datetime', 'matplotlib.tempfile', 
'distutils.sysconfig', 'encodings.encodings', 'pytz.cStringIO', 'xml', 
'distutils.dep_util', 'struct', 'tempfile', 'xml.sax.urllib', 'imp', 
'_struct', 'pytz.os', 'zipimport', 'string', 'encodings.utf_8', 
'matplotlib.__future__', 'pytz.tzinfo', 'pytz.datetime', 
'distutils.re', 'bisect', 'signal', 'random', 'xml.sax.xmlreader', 
'matplotlib.pytz', 'distutils.log', 'pytz.tzfile', 'cStringIO', 
'pkgutil', 'locale', 'xml.sax.saxutils', 'encodings', 'dateutil', 
'matplotlib.warnings', 'matplotlib.string', 'pytz.pytz', 'urllib', 
'matplotlib.sys', 're', 'new', 'math', 'fcntl', 'UserDict', 
'distutils.os', 'matplotlib', 'codecs', 'md5', '_locale', 
'matplotlib.sre_constants', 'matplotlib.os', 'thread', 
'pkg_resources', 'weakref', 'itertools', 'distutils.spawn', 
'distutils.sys', 'os', 'sre_parse', '__future__', 'matplotlib.copy', 
'xml.sax.types', '_sre', '__builtin__', 'matplotlib.re', 'operator', 
'distutils.util', 'distutils.string', 'matplotlib.datetime', 
'posixpath', 'errno', '_socket', 'binascii', 'sre_constants', 
'matplotlib.md5', 'types', 'pytz.sys', 'xml.sax.handler', 
'pytz.pkg_resources', 'xml.sax.os', 'matplotlib.xml', '_codecs', 
'pytz', 'matplotlib.pyparsing', 'copy', 'socket', '_types', 
'matplotlib.dateutil', 'hashlib', 'posix', 'encodings.aliases', 
'matplotlib.fontconfig_pattern', 'exceptions', 'xml.sax._exceptions', 
'pytz.bisect', 'distutils.distutils', 'copy_reg', 'sre_compile', 
'xml.sax', '_hashlib', '_random', 'pytz.struct', 'site', '__main__', 
'shutil', 'matplotlib.weakref', 'strop', 'encodings.codecs', 
'gettext', 'matplotlib.rcsetup', 'pytz.sets', 'xml.sax.codecs', 
'stat', '_ssl', 'warnings', 'encodings.types', 'sets', 'sys', 
'xml.sax.sys', 'os.path', 'pytz.gettext', 'matplotlib.distutils', 
'_weakref', 'distutils.errors', 'urlparse', 'linecache', 
'matplotlib.shutil', 'time']
Using fontManager instance from 
/home/paulsimon/.matplotlib/fontManager.cache

numerix numpy 1.0.4
backend GTKAgg version 2.12.1
 findfont found Bitstream Vera Sans, normal, normal 400, normal, 8.0
findfont returning 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf

 findfont found Bitstream Vera Sans, normal, normal 400, normal, 8.0
findfont returning 

Re: [Matplotlib-users] Running matplotlib job with cron

2009-06-25 Thread Paul Simon
Hi Sandro,

There is no image output when the script is run from cron.  I think that is 
what you are asking.

I thought about updating matplotlib but at this point don't want to change 
versions unless all else fails. Im running Mandriva 2008.1 and it's a lot 
of work.

Is there a more detailed way I can debug to find out where the failure is?

Paul

- Original Message - 
From: Sandro Tosi matrixh...@gmail.com
To: Paul Simon psi...@sonic.net
Cc: matplotlib-users@lists.sourceforge.net
Sent: Thursday, June 25, 2009 12:00 PM
Subject: Re: [Matplotlib-users] Running matplotlib job with cron


 Hello Paul,

 On Thu, Jun 25, 2009 at 19:13, Paul Simonpsi...@sonic.net wrote:
 I've written my first python script with matplotlib, which works fine at 
 the
 command line but not with cron. It's quite puzzling to me, and probably
 involves some path declaration that I don't know about.

 I may have read the mail fast, but I can't see any notice about if the
 image outputs are different (other than the textual outputs).

 matplotlib version 0.91.2

 You might also want to update: matplotlib latest release is 0.98.5.3

 Regards,
 -- 
 Sandro Tosi (aka morph, morpheus, matrixhasu)
 My website: http://matrixhasu.altervista.org/
 Me at Debian: http://wiki.debian.org/SandroTosi

 



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


Re: [Matplotlib-users] Running matplotlib job with cron

2009-06-25 Thread Eric Firing

Paul Simon wrote:
I've written my first python script with matplotlib, which works fine at 
the command line but not with cron.  It's quite puzzling to me, and 
probably involves some path declaration that I don't know about.
 
#plot data from automate.csv

import matplotlib


Right here you should include:

matplotlib.use('Agg')

Without this, you are loading the interactive graphical backend, gtkagg. 
I don't know whether this is causing the problem with running under 
cron, but it is worth changing anyway.


I don't know why your debug output file is stopping after the first 
fontManager line.


What does your crontab file look like?  I think this is more a cron 
problem than an mpl problem.  Cron tends to run things in a very 
different environment than one has when running from the command line, 
and it is common--at least in my own experience--to have this sort of 
problem with things that work on the command line and not from cron.


Attached is a crontab file that we use in this manner.  Note that we set 
the shell to /bin/bash; otherwise cron will use the most minimal shell 
version.  Second, note that before executing the script, we execute a 
file that sets up the environment to be similar to what we have when 
logged in normally.  Third, the redirection of stdout and stderr to a 
log file facilitates debugging, allowing you to see the result of 
debugging print statements as well as any exceptions or other error 
messages.


Eric


import datetime
import numpy
from matplotlib import legend
from matplotlib.pyplot import figure, show, plot_date, setp, ylabel, 
savefig, xlabel
from matplotlib.dates import DayLocator, HourLocator, DateLocator, 
DateFormatter,drange, MinuteLocator, date2num, num2date

from matplotlib.mlab import csv2rec
from matplotlib.ticker import *
newr = csv2rec('/home/paulsimon/Documents/automate.csv')
x = date2num(newr.field(0))
fig = figure()
ax1 = fig.add_subplot(111)
line1, = ax1.plot_date(newr['dattim'], newr['bench_1'], '-r',label = 
'bench 1')
line2, = ax1.plot_date(newr['dattim'], newr['bench_2'], '-b', label = 
'bench 2')

line3, = ax1.plot_date(newr['dattim'], newr['eave'],'-k', label = 'eave')
line4, = ax1.plot_date(newr['dattim'], newr['outside'], '-g', label = 
'outside')
 
ylabel('temperature')

xlabel(r'time/date')
hours = HourLocator(range(0,26,4))
 
dateformatter = DateFormatter('%I:%M %p\n%m/%d/%y')

ax1.xaxis.set_major_formatter(dateformatter)
ax1.xaxis.set_major_locator(hours)
ax1.set_ylim(30,100)
# Rotate x labels
for label in ax1.xaxis.get_ticklabels():
label.set_fontsize(8)
 
ax1.grid(True)

ax1.xaxis.grid(False)
yminorLocator = MultipleLocator(5)
ax1.yaxis.set_minor_locator(yminorLocator)
ax1.yaxis.grid(True,which='major', linestyle ='-')
ax1.yaxis.grid(True,which='minor',linestyle = ':')
leg = ax1.legend(('bench 1', 'bench 2', ' eave',  'outside'), 'lower 
right', shadow = True)

for t in leg.get_texts():
t.set_fontsize('small')
   
savefig('/home/paulsimon/python_scripts/image.png', format = 'png')
 


Running with --debug option, here are the two different output files:
 
$HOME=/home/paulsimon

CONFIGDIR=/home/paulsimon/.matplotlib
matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file 
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc

matplotlib version 0.91.2
verbose.level debug
interactive is False
units is False
platform is linux2
loaded modules: ['_bisect', 'xml.sax.urlparse', 'distutils', 
'matplotlib.matplotlib', 'datetime', 'matplotlib.tempfile', 
'distutils.sysconfig', 'encodings.encodings', 'pytz.cStringIO', 'xml', 
'distutils.dep_util', 'struct', 'tempfile', 'xml.sax.urllib', 'imp', 
'_struct', 'pytz.os', 'zipimport', 'string', 'encodings.utf_8', 
'matplotlib.__future__', 'pytz.tzinfo', 'pytz.datetime', 'distutils.re', 
'bisect', 'signal', 'random', 'xml.sax.xmlreader', 'matplotlib.pytz', 
'distutils.log', 'pytz.tzfile', 'cStringIO', 'pkgutil', 'locale', 
'xml.sax.saxutils', 'encodings', 'dateutil', 'matplotlib.warnings', 
'matplotlib.string', 'pytz.pytz', 'urllib', 'matplotlib.sys', 're', 
'new', 'math', 'fcntl', 'UserDict', 'distutils.os', 'matplotlib', 
'codecs', 'md5', '_locale', 'matplotlib.sre_constants', 'matplotlib.os', 
'thread', 'pkg_resources', 'weakref', 'itertools', 'distutils.spawn', 
'distutils.sys', 'os', 'sre_parse', '__future__', 'matplotlib.copy', 
'xml.sax.types', '_sre', '__builtin__', 'matplotlib.re', 'operator', 
'distutils.util', 'distutils.string', 'matplotlib.datetime', 
'posixpath', 'errno', '_socket', 'binascii', 'sre_constants', 
'matplotlib.md5', 'types', 'pytz.sys', 'xml.sax.handler', 
'pytz.pkg_resources', 'xml.sax.os', 'matplotlib.xml', '_codecs', 'pytz', 
'matplotlib.pyparsing', 'copy', 'socket', '_types', 
'matplotlib.dateutil', 'hashlib', 'posix', 'encodings.aliases', 
'matplotlib.fontconfig_pattern', 'exceptions', 'xml.sax._exceptions', 
'pytz.bisect', 'distutils.distutils', 'copy_reg', 'sre_compile', 
'xml.sax', '_hashlib', '_random', 

Re: [Matplotlib-users] Running matplotlib job with cron

2009-06-25 Thread jules hummon
Paul

Eric's attachment was missing.

This is the crontab we use, which he described:
- we use bash
- the file config/bash_env has most of what is usually in .bashrc;
for cron we source it, for shell we source it in .bashrc
- daily.py --use_defaults is the command that we want to run
- don't forget that early inclusion of
matplotlib.use('Agg')

## here is the relevant part of crontab
# m h  dom mon dow   command
40 20 * * * (cd $HOME; . config/bash_env; daily.py --use_defaults)  
$HOME/tmp/cron.log 2 1

Reference for matplotlib.use('Agg'):

http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=agg#generate-images-without-having-a-window-popup

Jules


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


[Matplotlib-users] Stopping Legend From Overlapping the Graph

2009-06-25 Thread Chris Spencer
How do you show the legend below the graph, so it doesn't overlap at
all with the graph? The docs for the legend() loc parameter only
seem to specify where *on* the graph you want it to show, which is
driving me nuts because even using best, it usually hides some of my
data.

I want to see *all* of my graph, as well as the legend. Is there any
way to do this with pylab?

Any help is appreciated.

Chris

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


Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph

2009-06-25 Thread Jae-Joon Lee
The linked page below shows how you put the legend above the graph.

http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location

You can put it below the axes by adjusting the bbox_to_anchor parameter.
Try something like
  bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1

Make sure to adjust the suplot parameter (or axes location) to make
enough room for the legend.

-JJ



On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote:
 How do you show the legend below the graph, so it doesn't overlap at
 all with the graph? The docs for the legend() loc parameter only
 seem to specify where *on* the graph you want it to show, which is
 driving me nuts because even using best, it usually hides some of my
 data.

 I want to see *all* of my graph, as well as the legend. Is there any
 way to do this with pylab?

 Any help is appreciated.

 Chris

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


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