Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions 27 lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def split_code_at_show(text):
TEMPLATE = """
{{ source_code }}

{{ only_html }}
.. only:: html

{% if source_link or (html_show_formats and not multi_image) %}
(
Expand Down Expand Up @@ -384,29 +384,15 @@ def split_code_at_show(text):
{{ caption }}
{% endfor %}

{{ only_latex }}
.. only:: not html

{% for img in images %}
{% if 'pdf' in img.formats -%}
.. figure:: {{ build_dir }}/{{ img.basename }}.pdf
.. figure:: {{ build_dir }}/{{ img.basename }}.*
{% for option in options -%}
{{ option }}
{% endfor %}

{{ caption }}
{% endif -%}
{% endfor %}

{{ only_texinfo }}

{% for img in images %}
{% if 'png' in img.formats -%}
.. image:: {{ build_dir }}/{{ img.basename }}.png
{% for option in options -%}
{{ option }}
{% endfor %}

{% endif -%}
{% endfor %}

"""
Expand Down Expand Up @@ -777,10 +763,6 @@ def run(arguments, content, options, state_machine, state, lineno):
':%s: %s' % (key, val) for key, val in options.items()
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]

only_html = ".. only:: html"
only_latex = ".. only:: latex"
only_texinfo = ".. only:: texinfo"

# Not-None src_link signals the need for a source link in the generated
# html
if j == 0 and config.plot_html_show_source_link:
Expand All @@ -794,9 +776,6 @@ def run(arguments, content, options, state_machine, state, lineno):
build_dir=build_dir_link,
source_link=src_link,
multi_image=len(images) > 1,
only_html=only_html,
only_latex=only_latex,
only_texinfo=only_texinfo,
options=opts,
images=images,
source_code=source_code,
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.