I have added a new "plot" directive to our doc infrastructure that does:
""" A special directive for including a matplotlib plot. Given a path to a .py file: - On HTML, will include a .png with a link to a high-res .png. - On LaTeX, will include a .pdf This directive supports all of the options of the `image` directive, except for `target` (since plot will add its own target). Additionally, if the :include-source: option is provided, the literal source will be included inline, as well as a link to the source. """ This task took a lot longer than I expected, so I'm going to have to pause for a while. But here's a couple of notes for improvement if anyone wants to take it on: 1) Clicking on the image in HTML currently goes to a high-res PNG. It could instead go to a PDF, which personally I think is preferable, but I know some people are adamantly opposed to installing a PDF plugin in their browser. 2) This only works if the .py files live in users/figures. A more general solution might be to move the actual rendering of .png and .pdf plots (which currently occurs in users/figures/make.py) to the plot directive itself, and have them rendered even more on-the-fly than they are already. Then it could pull .py's from anywhere (such as mpl-examples) and put the resulting images in the correct place for sphinx to find them and add them to the build. 3) The CSS could be tweaked so the images don't get a thick border in HTML. Putting a magnifying glass in the corner would be cool if there's any CSS wizards out there. But that's an aesthetic consideration. People may like the border. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel