Discussion:
[Matplotlib-users] matplotlib documentation from python notebook?
Jody Klymak
2015-06-08 17:06:53 UTC
Permalink
Hi all,

If I want to contribute *.rst files to the matplotlib documentation, I can see a few styles already contributed, at least one of which makes extensive use of ipython (http://matplotlib.org/users/image_tutorial.html). However, even it makes use of `.. sourcecode:: python` and `.. plot::` blocks.

If I convert an ipython notebook to rst, it formats as: `.. code:: python` and instead of making plots it loads images:
`.. image:: MyExample_files/MyExample_1_0.png`

So, is there an acceptable way to directly make matplotlib documentation directly from a notebook? I didn’t see anything, but wanted to check, as that would by far be the easiest way to make a *.rst that had structured text, code, and plots.

Thanks, Jody

--
Jody Klymak
http://web.uvic.ca/~jklymak/






------------------------------------------------------------------------------
Benjamin Root
2015-06-08 20:35:38 UTC
Permalink
No, there isn't an accepted way to do that AFAIK. However, it doesn't seem
like it is all that far off. Our doc-build process will create the images
from the examples automatically, so you don't need to include the image
tag. It is sort of a way to make sure the examples work and that the image
matches the code correctly.
Post by Jody Klymak
Hi all,
If I want to contribute *.rst files to the matplotlib documentation, I can
see a few styles already contributed, at least one of which makes extensive
use of ipython (http://matplotlib.org/users/image_tutorial.html).
However, even it makes use of `.. sourcecode:: python` and `.. plot::`
blocks.
If I convert an ipython notebook to rst, it formats as: `.. code:: python`
`.. image:: MyExample_files/MyExample_1_0.png`
So, is there an acceptable way to directly make matplotlib documentation
directly from a notebook? I didn’t see anything, but wanted to check, as
that would by far be the easiest way to make a *.rst that had structured
text, code, and plots.
Thanks, Jody
--
Jody Klymak
http://web.uvic.ca/~jklymak/
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jody Klymak
2015-06-08 21:26:47 UTC
Permalink
Hi Ben,

My idea was to just make the notebook the “example”. But nbconvert-ing the notebook makes static images that then need to be checked into the repository, and take space, so I wasn’t sure how desirable that was.

It would be fun to have the documentation script accept ipython notebooks and run nbconvert on them. Being able to save state as you work through examples is quite nice, versus creating five or six standalone *.py files that then get run at build time. Of course you are adding a dependency to anyone who has wants to build the docs.

Thanks, Jody
No, there isn't an accepted way to do that AFAIK. However, it doesn't seem like it is all that far off. Our doc-build process will create the images from the examples automatically, so you don't need to include the image tag. It is sort of a way to make sure the examples work and that the image matches the code correctly.
Hi all,
If I want to contribute *.rst files to the matplotlib documentation, I can see a few styles already contributed, at least one of which makes extensive use of ipython (http://matplotlib.org/users/image_tutorial.html <http://matplotlib.org/users/image_tutorial.html>). However, even it makes use of `.. sourcecode:: python` and `.. plot::` blocks.
`.. image:: MyExample_files/MyExample_1_0.png`
So, is there an acceptable way to directly make matplotlib documentation directly from a notebook? I didn’t see anything, but wanted to check, as that would by far be the easiest way to make a *.rst that had structured text, code, and plots.
Thanks, Jody
--
Jody Klymak
http://web.uvic.ca/~jklymak/ <http://web.uvic.ca/~jklymak/>
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
--
Jody Klymak
http://web.uvic.ca/~jklymak/

Loading...