@@ -377,7 +377,7 @@ def remove_coding(text):
377
377
{% endif %}
378
378
379
379
{% for img in images %}
380
- .. figure:: {{ build_dir }}/{{ img.basename }}.png
380
+ .. figure:: {{ build_dir }}/{{ img.basename }}.{{ default_fmt }}
381
381
{% for option in options -%}
382
382
{{ option }}
383
383
{% endfor %}
@@ -541,8 +541,7 @@ def render_figures(code, code_path, output_dir, output_base, context,
541
541
function_name , config , context_reset = False ,
542
542
close_figs = False ):
543
543
"""
544
- Run a pyplot script and save the low and high res PNGs and a PDF
545
- in *output_dir*.
544
+ Run a pyplot script and save the images in *output_dir*.
546
545
547
546
Save the images under *output_dir* with file names derived from
548
547
*output_base*
@@ -559,7 +558,7 @@ def render_figures(code, code_path, output_dir, output_base, context,
559
558
for fmt in plot_formats :
560
559
if isinstance (fmt , six .string_types ):
561
560
if ':' in fmt :
562
- suffix ,dpi = fmt .split (':' )
561
+ suffix , dpi = fmt .split (':' )
563
562
formats .append ((str (suffix ), int (dpi )))
564
563
else :
565
564
formats .append ((fmt , default_dpi .get (fmt , 80 )))
@@ -666,6 +665,14 @@ def run(arguments, content, options, state_machine, state, lineno):
666
665
config = document .settings .env .config
667
666
nofigs = 'nofigs' in options
668
667
668
+ plot_formats = config .plot_formats
669
+ if isinstance (plot_formats , six .string_types ):
670
+ # String Sphinx < 1.3, Split on , to mimic
671
+ # Sphinx 1.3 and later. Sphinx 1.3 always
672
+ # returns a list.
673
+ plot_formats = plot_formats .split (',' )
674
+ default_fmt = plot_formats [0 ][0 ]
675
+
669
676
options .setdefault ('include-source' , config .plot_include_source )
670
677
keep_context = 'context' in options
671
678
context_opt = None if not keep_context else options ['context' ]
@@ -814,6 +821,7 @@ def run(arguments, content, options, state_machine, state, lineno):
814
821
815
822
result = format_template (
816
823
config .plot_template or TEMPLATE ,
824
+ default_fmt = default_fmt ,
817
825
dest_dir = dest_dir_link ,
818
826
build_dir = build_dir_link ,
819
827
source_link = src_link ,
0 commit comments