On Fri, Jul 31, 2009 at 1:10 PM, John Hunter<jdh2...@gmail.com> wrote:

> 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.

OK, I committed a first pass at this to HEAD.  I created a new svn
directory called mpl_data

  svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/mpl_data

and a cbook.get_mpl_data function, as used in this example::

    import matplotlib.cbook as cbook
    import matplotlib.pyplot as plt
    fname = cbook.get_mpl_data('lena.png', asfileobj=False)

    print 'fname', fname
    im = plt.imread(fname)
    plt.imshow(im)
    plt.show()

The function will check ~/.matplotlib/mpl_data and fetch it using
urllib from svn HEAD if it is not there, caching in the process.  It
would be nice to support an svn revision (w/o relying on svn) as I
note in this comment in get_mpl_data:

    # TODO: how to handle stale data in the cache that has been
    # updated from svn -- is there a clean http way to get the current
    # revision number that will not leave us at the mercy of html
    # changes at sf?


If others agree w/ the basic concept, we should port as many data
requiring examples over, removing data from examples/data and
lib/matplotlib/mpl-data/example as we go.  This will result in smaller
tarballs and binaries, and make the examples more portable.

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