nbsphinx icon indicating copy to clipboard operation
nbsphinx copied to clipboard

figure captions for plots

Open rddaz2013 opened this issue 7 years ago • 3 comments

captions with markdown images work perfect.

Im trying to get figure captions working on matlibplot plots...

On https://github.com/elegant-scipy/elegant-scipy/issues/239 there is @yeus with this...

#explicitly create figure: fig, ax = plt.subplots(figsize=(8,8), facecolor='w', edgecolor='k') (...)

#then at the end: display(fig, metadata={"label" : "fig:foo", "caption" : "bar"})

Is this metadata think used within nbsphinx? if this could be worked out with the display command it will work on every image.

rddaz2013 avatar Nov 17 '18 08:11 rddaz2013

Currently, the only metadata that's handled by nbsphinx is "height" and "width", see #21.

I'm open for a PR that adds support for figure labels and captions.

Should this only work for LaTeX or also for HTML output?

mgeier avatar Nov 18 '18 21:11 mgeier

Because of http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig it should be working on both html and latex.

I only have to rebuild my ploting workflow to work with this - then i release the next patch

rddaz2013 avatar Nov 25 '18 10:11 rddaz2013

If numfig is active - all images and chapters have numbers. Only if the output is html direct markdown images have no numbering.

rddaz2013 avatar Nov 30 '18 06:11 rddaz2013