I'm trying to use the matplotlib Sphinx plot extension to add some
diagrams to Sphinx documentation. However, I've come across a couple of
First, my Sphinx documentation uses the "separate directories for source
and build" option. It seems that matplotlib doesn't work well with this
1) I think the "pyplot" directory should be under the "source"
directory. But I had to put it one level up from the "source" directory
otherwise it wouldn't be found.
2) When I try to build, I get error messages such as:
image file not readable: build/pyplots/cobsr_overhead.png
It should be "../build/pyplots/cobsr_overhead.png" instead I think.
Secondly, on Windows, it generates the plots and creates links to the
images. However, the image filename gets any spaces stripped out of it,
so Sphinx can't locate the images. On further investigation I'm pretty
sure that the problem is with Sphinx itself, not the matplotlib
extension--the problem happens even if I just add a ".. image::" in
Sphinx. I thought I should at least mention it here in case anyone else
is coming across the same issue. I'll plan to report it to the Sphinx