Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix #5573: Use SVG in docs#5677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:masterfrommdboom:docs-svg
Dec 16, 2015
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletiondoc/conf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,7 +114,7 @@
# Plot directive configuration
# ----------------------------

plot_formats = [('png',80), ('hires.png',200), ('pdf', 50)]
plot_formats = [('svg',72), ('png',80)]

# Subdirectories in 'examples/' directory of package and titles for gallery
mpl_example_sections = (
Expand Down
35 changes: 21 additions & 14 deletionslib/matplotlib/sphinxext/plot_directive.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -377,7 +377,7 @@ def remove_coding(text):
{% endif %}

{% for img in images %}
.. figure:: {{ build_dir }}/{{ img.basename }}.png
.. figure:: {{ build_dir }}/{{ img.basename }}.{{ default_fmt }}
{% for option in options -%}
{{ option }}
{% endfor %}
Expand DownExpand Up@@ -537,17 +537,7 @@ def clear_state(plot_rcparams, close=True):
matplotlib.rcParams.update(plot_rcparams)


def render_figures(code, code_path, output_dir, output_base, context,
function_name, config, context_reset=False,
close_figs=False):
"""
Run a pyplot script and save the low and high res PNGs and a PDF
in *output_dir*.

Save the images under *output_dir* with file names derived from
*output_base*
"""
# -- Parse format list
def get_plot_formats(config):
default_dpi = {'png': 80, 'hires.png': 200, 'pdf': 200}
formats = []
plot_formats = config.plot_formats
Expand All@@ -559,14 +549,27 @@ def render_figures(code, code_path, output_dir, output_base, context,
for fmt in plot_formats:
if isinstance(fmt, six.string_types):
if ':' in fmt:
suffix,dpi = fmt.split(':')
suffix,dpi = fmt.split(':')
formats.append((str(suffix), int(dpi)))
else:
formats.append((fmt, default_dpi.get(fmt, 80)))
elif type(fmt) in (tuple, list) and len(fmt)==2:
elif type(fmt) in (tuple, list) and len(fmt) ==2:
formats.append((str(fmt[0]), int(fmt[1])))
else:
raise PlotError('invalid image format "%r" in plot_formats' % fmt)
return formats


def render_figures(code, code_path, output_dir, output_base, context,
function_name, config, context_reset=False,
close_figs=False):
"""
Run a pyplot script and save the images in *output_dir*.

Save the images under *output_dir* with file names derived from
*output_base*
"""
formats = get_plot_formats(config)

# -- Try to determine if all images already exist

Expand DownExpand Up@@ -666,6 +669,9 @@ def run(arguments, content, options, state_machine, state, lineno):
config = document.settings.env.config
nofigs = 'nofigs' in options

formats = get_plot_formats(config)
default_fmt = formats[0][0]

options.setdefault('include-source', config.plot_include_source)
keep_context = 'context' in options
context_opt = None if not keep_context else options['context']
Expand DownExpand Up@@ -814,6 +820,7 @@ def run(arguments, content, options, state_machine, state, lineno):

result = format_template(
config.plot_template or TEMPLATE,
default_fmt=default_fmt,
dest_dir=dest_dir_link,
build_dir=build_dir_link,
source_link=src_link,
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/textpath.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -343,7 +343,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
1094995778)]:
try:
font.select_charmap(charmap_code)
except ValueError:
except(ValueError, RuntimeError):
pass
else:
break
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp