diff --git a/docs/_static/images-rotate-info.js b/docs/_static/images-rotate-info.js index 2764f4d..cb964b9 100644 --- a/docs/_static/images-rotate-info.js +++ b/docs/_static/images-rotate-info.js @@ -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"}, -]; \ No newline at end of file +]; diff --git a/docs/_static/images-rotate/_generate_images.py b/docs/_static/images-rotate/_generate_images.py index ce31a55..525898f 100644 --- a/docs/_static/images-rotate/_generate_images.py +++ b/docs/_static/images-rotate/_generate_images.py @@ -1,6 +1,6 @@ from pathlib import Path -import logging +import logging import matplotlib matplotlib.use('Agg') @@ -8,28 +8,37 @@ _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) \ No newline at end of file +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') diff --git a/docs/_static/images-rotate/bar300.png b/docs/_static/images-rotate/bar300.png index b9a009c..1a9bb51 100644 Binary files a/docs/_static/images-rotate/bar300.png and b/docs/_static/images-rotate/bar300.png differ diff --git a/docs/_static/images-rotate/barbs300.png b/docs/_static/images-rotate/barbs300.png index 13fb9de..c184e34 100644 Binary files a/docs/_static/images-rotate/barbs300.png and b/docs/_static/images-rotate/barbs300.png differ diff --git a/docs/_static/images-rotate/boxplot_plot300.png b/docs/_static/images-rotate/boxplot_plot300.png index 70b6307..7721727 100644 Binary files a/docs/_static/images-rotate/boxplot_plot300.png and b/docs/_static/images-rotate/boxplot_plot300.png differ diff --git a/docs/_static/images-rotate/contour300.png b/docs/_static/images-rotate/contour300.png index d4d538f..fc78061 100644 Binary files a/docs/_static/images-rotate/contour300.png and b/docs/_static/images-rotate/contour300.png differ diff --git a/docs/_static/images-rotate/contourf300.png b/docs/_static/images-rotate/contourf300.png index 0ee8074..3208536 100644 Binary files a/docs/_static/images-rotate/contourf300.png and b/docs/_static/images-rotate/contourf300.png differ diff --git a/docs/_static/images-rotate/ecdf300.png b/docs/_static/images-rotate/ecdf300.png new file mode 100644 index 0000000..cf583be Binary files /dev/null and b/docs/_static/images-rotate/ecdf300.png differ diff --git a/docs/_static/images-rotate/errorbar_plot300.png b/docs/_static/images-rotate/errorbar_plot300.png index b41cbc5..e87a38b 100644 Binary files a/docs/_static/images-rotate/errorbar_plot300.png and b/docs/_static/images-rotate/errorbar_plot300.png differ diff --git a/docs/_static/images-rotate/eventplot300.png b/docs/_static/images-rotate/eventplot300.png index d6301ee..b178da1 100644 Binary files a/docs/_static/images-rotate/eventplot300.png and b/docs/_static/images-rotate/eventplot300.png differ diff --git a/docs/_static/images-rotate/fill_between300.png b/docs/_static/images-rotate/fill_between300.png index 9e536b2..1362e73 100644 Binary files a/docs/_static/images-rotate/fill_between300.png and b/docs/_static/images-rotate/fill_between300.png differ diff --git a/docs/_static/images-rotate/hexbin300.png b/docs/_static/images-rotate/hexbin300.png index 62a9137..e69d87a 100644 Binary files a/docs/_static/images-rotate/hexbin300.png and b/docs/_static/images-rotate/hexbin300.png differ diff --git a/docs/_static/images-rotate/hist2d300.png b/docs/_static/images-rotate/hist2d300.png index dde8dd2..972c809 100644 Binary files a/docs/_static/images-rotate/hist2d300.png and b/docs/_static/images-rotate/hist2d300.png differ diff --git a/docs/_static/images-rotate/hist_plot300.png b/docs/_static/images-rotate/hist_plot300.png index b0bc024..f8f52eb 100644 Binary files a/docs/_static/images-rotate/hist_plot300.png and b/docs/_static/images-rotate/hist_plot300.png differ diff --git a/docs/_static/images-rotate/imshow300.png b/docs/_static/images-rotate/imshow300.png index 93992d6..fccefae 100644 Binary files a/docs/_static/images-rotate/imshow300.png and b/docs/_static/images-rotate/imshow300.png differ diff --git a/docs/_static/images-rotate/pcolormesh300.png b/docs/_static/images-rotate/pcolormesh300.png index 17a391f..606dc41 100644 Binary files a/docs/_static/images-rotate/pcolormesh300.png and b/docs/_static/images-rotate/pcolormesh300.png differ diff --git a/docs/_static/images-rotate/pie300.png b/docs/_static/images-rotate/pie300.png index 9950443..b616cce 100644 Binary files a/docs/_static/images-rotate/pie300.png and b/docs/_static/images-rotate/pie300.png differ diff --git a/docs/_static/images-rotate/plot300.png b/docs/_static/images-rotate/plot300.png index 60a5fd9..bdd599b 100644 Binary files a/docs/_static/images-rotate/plot300.png and b/docs/_static/images-rotate/plot300.png differ diff --git a/docs/_static/images-rotate/quiver300.png b/docs/_static/images-rotate/quiver300.png index 4abff99..d28f354 100644 Binary files a/docs/_static/images-rotate/quiver300.png and b/docs/_static/images-rotate/quiver300.png differ diff --git a/docs/_static/images-rotate/scatter_plot300.png b/docs/_static/images-rotate/scatter_plot300.png index 6657ab1..2130125 100644 Binary files a/docs/_static/images-rotate/scatter_plot300.png and b/docs/_static/images-rotate/scatter_plot300.png differ diff --git a/docs/_static/images-rotate/stackplot300.png b/docs/_static/images-rotate/stackplot300.png new file mode 100644 index 0000000..01889e7 Binary files /dev/null and b/docs/_static/images-rotate/stackplot300.png differ diff --git a/docs/_static/images-rotate/stairs300.png b/docs/_static/images-rotate/stairs300.png new file mode 100644 index 0000000..351fb22 Binary files /dev/null and b/docs/_static/images-rotate/stairs300.png differ diff --git a/docs/_static/images-rotate/stem300.png b/docs/_static/images-rotate/stem300.png index ee3194f..7b0ee7d 100644 Binary files a/docs/_static/images-rotate/stem300.png and b/docs/_static/images-rotate/stem300.png differ diff --git a/docs/_static/images-rotate/step300.png b/docs/_static/images-rotate/step300.png deleted file mode 100644 index 88d3d4e..0000000 Binary files a/docs/_static/images-rotate/step300.png and /dev/null differ diff --git a/docs/_static/images-rotate/streamplot300.png b/docs/_static/images-rotate/streamplot300.png index f282d0b..955af22 100644 Binary files a/docs/_static/images-rotate/streamplot300.png and b/docs/_static/images-rotate/streamplot300.png differ diff --git a/docs/_static/images-rotate/violin300.png b/docs/_static/images-rotate/violin300.png index 7f790aa..4c78169 100644 Binary files a/docs/_static/images-rotate/violin300.png and b/docs/_static/images-rotate/violin300.png differ