Clean up output of plotting directive:

- Do not generate PDFs.
 - Do not copy image to plots dir (Sphinx copies to _images already).
This commit is contained in:
Stefan van der Walt
2009-10-14 08:51:25 +02:00
parent 80a366761c
commit a47a60f8ae
2 changed files with 18 additions and 7 deletions
+17 -6
View File
@@ -173,20 +173,28 @@ TEMPLATE = """
{%- for option in options %}
{{ option }}
{% endfor %}
(`Source code <{{source_link}}>`__)
{# We do not need to link to all the different image
formats. The .png is included on the webpage, and a the
source snippet is given.
(
{%- if not source_code -%}
`Source code <{{source_link}}>`__
{%- for fmt in img.formats -%}
{%- for fmt in img.formats -%}
, `{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
{%- endfor -%}
{%- else -%}
{%- for fmt in img.formats -%}
{%- for fmt in img.formats -%}
{%- if not loop.first -%}, {% endif -%}
`{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
{%- endfor -%}
{%- endif -%}
)
#}
{% endfor %}
{{ only_latex }}
@@ -332,9 +340,12 @@ def run(arguments, content, options, state_machine, state, lineno):
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
for img in images:
for fn in img.filenames():
shutil.copyfile(fn, os.path.join(dest_dir, os.path.basename(fn)))
# Commented out so that images are not copied to the 'plots'
# directory. Sphinx copies to images to '_images' anyway, so no need.
# for img in images:
# for fn in img.filenames():
# shutil.copyfile(fn, os.path.join(dest_dir, os.path.basename(fn)))
# copy script (if necessary)
if source_file_name == rst_file:
+1 -1
View File
@@ -228,7 +228,7 @@ import matplotlib.pyplot as plt
np.random.seed(0)
"""
plot_include_source = False
plot_formats = [('png', 100), 'pdf']
plot_formats = [('png', 100)]
import math
phi = (math.sqrt(5) + 1)/2