Unfortunately, at present you can't.  The figure referencing in Sphinx works because there is a hard-coded phase to match labels to figures (which doesn't know about plots).  I think the matplotlib plot directive needs to write such a phase at well (should be possible using Sphinx event hooks) but it doesn't do that at the moment.

Can you file a feature request so this doesn't get forgotten?

Mike

On 11/26/2009 02:56 PM, Jose Gomez-Dans wrote:
Hi,
I'm not sure this is entirely on-topic as it relates to the matplotlib sphinx extension. I hope it's still acceptable!

I am writing some documentation using sphinx, and I would  like to refer plots that are rendered from an external python script. I can do the plot and it gets imported fine just by issuing

.. plot:: ../samples/MyPythonPlot.py

I would like to have a cross reference to it and a caption. If I were to select a normal figure, I could do this just by (see <http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>)

.. _my-figure:

.. figure:: whatever

   Figure caption
  
But how can I do this with a matplotlib plot rather than a png file?

Thanks!
J
------------------------------------------------------------------------------ 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users