In some examples, I have been moving example functions and data into a
module, so that they can be run from anywhere.  Many other examples
still rely on a relative path in the examples dir.   Eg, I go to the
gallery and download the source for the axes grid toolkit example
simple_rgb.py, and try to run it from my desktop, I get the error "no
module names demo_image".  While I know how to get the data, a naive
user will not.  So in some examples I have been adopting the approach,
eg in examples/pylab_examples/scatter_demo2.py

  import matplotlib
  datafile = matplotlib.get_example_data('goog.npy')

These examples will run anywhere mpl is installed.  Another approach
would to write a version of get_example_data that checks locally for a
datafile, and if it is not where you expect to be, attempt a
urlretrieve as a temp file.

The gallery is becoming the goto place for most users of the website,
and I would like as many examples as possible to run after a simple
download to the desktop .  I am sensitive to packagers who may not
want to ship large amounts of data w/ the main library, so we may want
to minimize the amount we ship in mpl-data which
matplotlib.get_example_data uses, but it may be a good idea to setup a
new svn directory at the top level (mpl_data) and write a urllib
enabled matplotlib.get_example_data that fetches it from the repo if
it can't find it locally.

JDH

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to