Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update image rotator for Matplotlib 3.8 #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
34 changes: 18 additions & 16 deletions docs/_static/images-rotate-info.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
var images_rotate = [
{"image": "quiver300.png", "caption": "quiver(X, Y, U, V)", "link": "plot_types/arrays/quiver.html"},
{"image": "imshow300.png", "caption": "imshow(Z)", "link": "plot_types/arrays/imshow.html"},
{"image": "pcolormesh300.png", "caption": "pcolormesh(X, Y, Z)", "link": "plot_types/arrays/pcolormesh.html"},
{"image": "contourf300.png", "caption": "contourf(X, Y, Z)", "link": "plot_types/arrays/contourf.html"},
{"image": "bar300.png", "caption": "bar(x, height)", "link": "plot_types/basic/bar.html"},
{"image": "barbs300.png", "caption": "barbs(X, Y, U, V)", "link": "plot_types/arrays/barbs.html"},
{"image": "boxplot_plot300.png", "caption": "boxplot(X)", "link": "plot_types/stats/boxplot_plot.html"},
{"image": "contour300.png", "caption": "contour(X, Y, Z)", "link": "plot_types/arrays/contour.html"},
{"image": "streamplot300.png", "caption": "streamplot(X, Y, U, V)", "link": "plot_types/arrays/streamplot.html"},
{"image": "plot300.png", "caption": "plot(x, y)", "link": "plot_types/basic/plot.html"},
{"image": "contourf300.png", "caption": "contourf(X, Y, Z)", "link": "plot_types/arrays/contourf.html"},
{"image": "ecdf300.png", "caption": "ecdf(x)", "link": "plot_types/stats/ecdf.html"},
{"image": "errorbar_plot300.png", "caption": "errorbar(x, y, yerr, xerr)", "link": "plot_types/stats/errorbar_plot.html"},
{"image": "eventplot300.png", "caption": "eventplot(D)", "link": "plot_types/stats/eventplot.html"},
{"image": "fill_between300.png", "caption": "fill_between(x, y1, y2)", "link": "plot_types/basic/fill_between.html"},
{"image": "step300.png", "caption": "step(x, y)", "link": "plot_types/basic/step.html"},
{"image": "scatter_plot300.png", "caption": "scatter(x, y)", "link": "plot_types/basic/scatter_plot.html"},
{"image": "stem300.png", "caption": "stem(x, y)", "link": "plot_types/basic/stem.html"},
{"image": "bar300.png", "caption": "bar(x, height) / barh(y, width)", "link": "plot_types/basic/bar.html"},
{"image": "hist_plot300.png", "caption": "hist(x)", "link": "plot_types/stats/hist_plot.html"},
{"image": "hexbin300.png", "caption": "hexbin(x, y, C)", "link": "plot_types/stats/hexbin.html"},
{"image": "hist2d300.png", "caption": "hist2d(x, y)", "link": "plot_types/stats/hist2d.html"},
{"image": "hist_plot300.png", "caption": "hist(x)", "link": "plot_types/stats/hist_plot.html"},
{"image": "imshow300.png", "caption": "imshow(Z)", "link": "plot_types/arrays/imshow.html"},
{"image": "pcolormesh300.png", "caption": "pcolormesh(X, Y, Z)", "link": "plot_types/arrays/pcolormesh.html"},
{"image": "pie300.png", "caption": "pie(x)", "link": "plot_types/stats/pie.html"},
{"image": "hexbin300.png", "caption": "hexbin(x, y, C)", "link": "plot_types/stats/hexbin.html"},
{"image": "boxplot_plot300.png", "caption": "boxplot(X)", "link": "plot_types/stats/boxplot_plot.html"},
{"image": "plot300.png", "caption": "plot(x, y)", "link": "plot_types/basic/plot.html"},
{"image": "quiver300.png", "caption": "quiver(X, Y, U, V)", "link": "plot_types/arrays/quiver.html"},
{"image": "scatter_plot300.png", "caption": "scatter(x, y)", "link": "plot_types/basic/scatter_plot.html"},
{"image": "stackplot300.png", "caption": "stackplot(x, y)", "link": "plot_types/basic/stackplot.html"},
{"image": "stairs300.png", "caption": "stairs(values)", "link": "plot_types/basic/stairs.html"},
{"image": "stem300.png", "caption": "stem(x, y)", "link": "plot_types/basic/stem.html"},
{"image": "streamplot300.png", "caption": "streamplot(X, Y, U, V)", "link": "plot_types/arrays/streamplot.html"},
{"image": "violin300.png", "caption": "violinplot(D)", "link": "plot_types/stats/violin.html"},
{"image": "errorbar_plot300.png", "caption": "errorbar(x, y, yerr, xerr)", "link": "plot_types/stats/errorbar_plot.html"},
{"image": "eventplot300.png", "caption": "eventplot(D)", "link": "plot_types/stats/eventplot.html"},
];
];
35 changes: 22 additions & 13 deletions docs/_static/images-rotate/_generate_images.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@

from pathlib import Path
import logging
import logging

import matplotlib
matplotlib.use('Agg')

_log = logging.getLogger(__name__)
# start to make info.js

stout = 'var images_rotate = [\n'
# assumes that your directory structure has matplotlib/ and mpl-brochure-site/
# at the same level relative each other.
home = Path('../../../../matplotlib/')
lines = {}
# assumes that your directory structure has matplotlib/ and mpl-brochure-site/
# at the same level relative each other.
home = Path('../../../../matplotlib/galleries')
dirs = ['plot_types/arrays/', 'plot_types/basic/', 'plot_types/stats/']
for d in dirs:
_log.info('working on: %s', d)
for fn in (home / d).glob('*.py'):
_log.info(' %s', fn)
name = fn.stem
exec(fn.read_text())
fig.savefig(f'{name}300.png', dpi=300)
# fig.savefig(f'{name}150.png', dpi=150)

local_vars = {}
global_vars = {}
exec(fn.read_text(), global_vars, local_vars)
local_vars['fig'].savefig(f'{name}300.png', dpi=300)

stop = False
for line in open(fn):
if stop:
cap = line[:-1]
break
if line[:3] == '===':
stop = True
stout += ' {' + f'"image": "{name}300.png", "caption": "{cap}", "link": "{d}{name}.html"' + '},\n'

stout += '];'
stop = True
lines[name] = (
f'"image": "{name}300.png", '
f'"caption": "{cap}", '
f'"link": "{d}{name}.html"'
)

open('../images-rotate-info.js', 'w').write(stout)
with open('../images-rotate-info.js', 'w') as stout:
stout.write('var images_rotate = [\n')
for _, line in sorted(lines.items()):
stout.write(' {' + line + '},\n')
stout.write('];\n')
Binary file modified docs/_static/images-rotate/bar300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/barbs300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/boxplot_plot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/contour300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/contourf300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images-rotate/ecdf300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/errorbar_plot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/eventplot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/fill_between300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/hexbin300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/hist2d300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/hist_plot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/imshow300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/pcolormesh300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/pie300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/plot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/quiver300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/scatter_plot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images-rotate/stackplot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images-rotate/stairs300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/stem300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_static/images-rotate/step300.png
Binary file not shown.
Binary file modified docs/_static/images-rotate/streamplot300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images-rotate/violin300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading