Help with plot_directive


I am running Matplotlib 0.98.6svn compiled from source on OSX and Sphinx
0.6.2. I am trying the following example to test plot_directive

.. plot::

    from numpy import linspace, sin
    import matplotlib.pylab as plt
    x = linspace(0.01,25, 10000)
    plt.plot(x, sin(x)/x)

When I 'make html', I get the warning messages:

/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.png
/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.pdf

and the plot is not embedded in my html page. The links 'hires.png' and
'pdf' do point to (readable) images, though. From build/html:

$ ls -l plot_directive/inline/
total 104
-rw-r--r-- 1 dpo dpo 41347 22 Jul 20:01 2d6f2be741.hires.png
-rw-r--r-- 1 dpo dpo 7370 22 Jul 20:01 2d6f2be741.pdf

Strangely, there is no 'png' link even though my specifies

plot_formats = ['png', 'hires.png', 'pdf']

If I look at the generated html, I notice that the "img" tag wants the png,
which doesn't exist. That is one problem.

The other problem is that the "img" tag searches for the png file in
build/plot_directive/inline/, which does not exist either.

The same happens in the LaTeX output. When I 'make latex' followed by 'make
all-pdf' from build/latex, I get the error message:

LaTeX Warning: File `build/plot_directive/inline/2d6f2be741.pdf' not found
on input line 499.
!pdfTeX error: pdflatex (file build/plot_directive/inline/2d6f2be741.pdf):
cannot find image file
==> Fatal error occurred, no output PDF file produced!

Indeed, the image files are in plot_directive/inline/ and not in
build/plot_directive/inline/. Changing the path in the .tex solves the

Thanks in advance,


View this message in context:
Sent from the matplotlib - users mailing list archive at