From 5626e576ae07653abf2cc0062cd24cff3e89d64d Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 2 Aug 2017 21:41:38 +0100 Subject: [PATCH 1/3] Last batch of pylab moves --- examples/{pylab_examples => animation}/movie_demo_sgskip.py | 0 .../{pylab_examples => event_handling}/ginput_demo_sgskip.py | 0 .../ginput_manual_clabel_sgskip.py | 0 .../barcode_demo.py | 0 .../demo_bboximage.py | 0 .../spy_demos.py | 0 .../eventcollection_demo.py | 0 .../eventplot_demo.py | 0 .../{pylab_examples => lines_bars_and_markers}/interp_demo.py | 0 .../markevery_demo.py | 0 .../{pylab_examples => lines_bars_and_markers}/masked_demo.py | 0 .../{pylab_examples => lines_bars_and_markers}/nan_test.py | 0 .../vline_hline_demo.py | 0 .../xcorr_acorr_demo.py | 0 examples/{pylab_examples => misc}/agg_buffer.py | 0 examples/{pylab_examples => misc}/agg_buffer_to_array.py | 0 examples/{pylab_examples => misc}/anchored_artists.py | 0 examples/{pylab_examples => misc}/coords_report.py | 0 examples/{pylab_examples => misc}/cursor_demo_sgskip.py | 0 examples/{pylab_examples => misc}/customize_rc.py | 0 examples/{pylab_examples => misc}/demo_agg_filter.py | 0 examples/{pylab_examples => misc}/demo_ribbon_box.py | 0 examples/{pylab_examples => misc}/fill_spiral.py | 0 examples/{pylab_examples => misc}/findobj_demo.py | 0 examples/{pylab_examples => misc}/hyperlinks_sgskip.py | 0 examples/{pylab_examples => misc}/load_converter.py | 0 examples/{pylab_examples => misc}/multipage_pdf.py | 0 examples/{pylab_examples => misc}/patheffect_demo.py | 0 examples/{pylab_examples => misc}/plotfile_demo.py | 0 examples/{pylab_examples => misc}/print_stdout_sgskip.py | 0 examples/{pylab_examples => misc}/pythonic_matplotlib.py | 0 examples/{pylab_examples => misc}/set_and_get.py | 0 examples/{pylab_examples => misc}/transoffset.py | 0 examples/{pylab_examples => misc}/webapp_demo_sgskip.py | 0 examples/{pylab_examples => misc}/zorder_demo.py | 0 examples/pylab_examples/README.txt | 4 ---- examples/{pylab_examples => scales}/aspect_loglog.py | 0 examples/{pylab_examples => scales}/symlog_demo.py | 0 .../{pylab_examples => shapes_and_collections}/hatch_demo.py | 0 .../{pylab_examples => shapes_and_collections}/marker_path.py | 0 .../{pylab_examples => specialty_plots}/system_monitor.py | 0 .../demo_tight_layout.py | 0 .../multiple_figs_demo.py | 0 .../demo_text_path.py | 0 .../multiline.py | 0 45 files changed, 4 deletions(-) rename examples/{pylab_examples => animation}/movie_demo_sgskip.py (100%) rename examples/{pylab_examples => event_handling}/ginput_demo_sgskip.py (100%) rename examples/{pylab_examples => event_handling}/ginput_manual_clabel_sgskip.py (100%) rename examples/{pylab_examples => images_contours_and_fields}/barcode_demo.py (100%) rename examples/{pylab_examples => images_contours_and_fields}/demo_bboximage.py (100%) rename examples/{pylab_examples => images_contours_and_fields}/spy_demos.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/eventcollection_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/eventplot_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/interp_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/markevery_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/masked_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/nan_test.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/vline_hline_demo.py (100%) rename examples/{pylab_examples => lines_bars_and_markers}/xcorr_acorr_demo.py (100%) rename examples/{pylab_examples => misc}/agg_buffer.py (100%) rename examples/{pylab_examples => misc}/agg_buffer_to_array.py (100%) rename examples/{pylab_examples => misc}/anchored_artists.py (100%) rename examples/{pylab_examples => misc}/coords_report.py (100%) rename examples/{pylab_examples => misc}/cursor_demo_sgskip.py (100%) rename examples/{pylab_examples => misc}/customize_rc.py (100%) rename examples/{pylab_examples => misc}/demo_agg_filter.py (100%) rename examples/{pylab_examples => misc}/demo_ribbon_box.py (100%) rename examples/{pylab_examples => misc}/fill_spiral.py (100%) rename examples/{pylab_examples => misc}/findobj_demo.py (100%) rename examples/{pylab_examples => misc}/hyperlinks_sgskip.py (100%) rename examples/{pylab_examples => misc}/load_converter.py (100%) rename examples/{pylab_examples => misc}/multipage_pdf.py (100%) rename examples/{pylab_examples => misc}/patheffect_demo.py (100%) rename examples/{pylab_examples => misc}/plotfile_demo.py (100%) rename examples/{pylab_examples => misc}/print_stdout_sgskip.py (100%) rename examples/{pylab_examples => misc}/pythonic_matplotlib.py (100%) rename examples/{pylab_examples => misc}/set_and_get.py (100%) rename examples/{pylab_examples => misc}/transoffset.py (100%) rename examples/{pylab_examples => misc}/webapp_demo_sgskip.py (100%) rename examples/{pylab_examples => misc}/zorder_demo.py (100%) delete mode 100644 examples/pylab_examples/README.txt rename examples/{pylab_examples => scales}/aspect_loglog.py (100%) rename examples/{pylab_examples => scales}/symlog_demo.py (100%) rename examples/{pylab_examples => shapes_and_collections}/hatch_demo.py (100%) rename examples/{pylab_examples => shapes_and_collections}/marker_path.py (100%) rename examples/{pylab_examples => specialty_plots}/system_monitor.py (100%) rename examples/{pylab_examples => subplots_axes_and_figures}/demo_tight_layout.py (100%) rename examples/{pylab_examples => subplots_axes_and_figures}/multiple_figs_demo.py (100%) rename examples/{pylab_examples => text_labels_and_annotations}/demo_text_path.py (100%) rename examples/{pylab_examples => text_labels_and_annotations}/multiline.py (100%) diff --git a/examples/pylab_examples/movie_demo_sgskip.py b/examples/animation/movie_demo_sgskip.py similarity index 100% rename from examples/pylab_examples/movie_demo_sgskip.py rename to examples/animation/movie_demo_sgskip.py diff --git a/examples/pylab_examples/ginput_demo_sgskip.py b/examples/event_handling/ginput_demo_sgskip.py similarity index 100% rename from examples/pylab_examples/ginput_demo_sgskip.py rename to examples/event_handling/ginput_demo_sgskip.py diff --git a/examples/pylab_examples/ginput_manual_clabel_sgskip.py b/examples/event_handling/ginput_manual_clabel_sgskip.py similarity index 100% rename from examples/pylab_examples/ginput_manual_clabel_sgskip.py rename to examples/event_handling/ginput_manual_clabel_sgskip.py diff --git a/examples/pylab_examples/barcode_demo.py b/examples/images_contours_and_fields/barcode_demo.py similarity index 100% rename from examples/pylab_examples/barcode_demo.py rename to examples/images_contours_and_fields/barcode_demo.py diff --git a/examples/pylab_examples/demo_bboximage.py b/examples/images_contours_and_fields/demo_bboximage.py similarity index 100% rename from examples/pylab_examples/demo_bboximage.py rename to examples/images_contours_and_fields/demo_bboximage.py diff --git a/examples/pylab_examples/spy_demos.py b/examples/images_contours_and_fields/spy_demos.py similarity index 100% rename from examples/pylab_examples/spy_demos.py rename to examples/images_contours_and_fields/spy_demos.py diff --git a/examples/pylab_examples/eventcollection_demo.py b/examples/lines_bars_and_markers/eventcollection_demo.py similarity index 100% rename from examples/pylab_examples/eventcollection_demo.py rename to examples/lines_bars_and_markers/eventcollection_demo.py diff --git a/examples/pylab_examples/eventplot_demo.py b/examples/lines_bars_and_markers/eventplot_demo.py similarity index 100% rename from examples/pylab_examples/eventplot_demo.py rename to examples/lines_bars_and_markers/eventplot_demo.py diff --git a/examples/pylab_examples/interp_demo.py b/examples/lines_bars_and_markers/interp_demo.py similarity index 100% rename from examples/pylab_examples/interp_demo.py rename to examples/lines_bars_and_markers/interp_demo.py diff --git a/examples/pylab_examples/markevery_demo.py b/examples/lines_bars_and_markers/markevery_demo.py similarity index 100% rename from examples/pylab_examples/markevery_demo.py rename to examples/lines_bars_and_markers/markevery_demo.py diff --git a/examples/pylab_examples/masked_demo.py b/examples/lines_bars_and_markers/masked_demo.py similarity index 100% rename from examples/pylab_examples/masked_demo.py rename to examples/lines_bars_and_markers/masked_demo.py diff --git a/examples/pylab_examples/nan_test.py b/examples/lines_bars_and_markers/nan_test.py similarity index 100% rename from examples/pylab_examples/nan_test.py rename to examples/lines_bars_and_markers/nan_test.py diff --git a/examples/pylab_examples/vline_hline_demo.py b/examples/lines_bars_and_markers/vline_hline_demo.py similarity index 100% rename from examples/pylab_examples/vline_hline_demo.py rename to examples/lines_bars_and_markers/vline_hline_demo.py diff --git a/examples/pylab_examples/xcorr_acorr_demo.py b/examples/lines_bars_and_markers/xcorr_acorr_demo.py similarity index 100% rename from examples/pylab_examples/xcorr_acorr_demo.py rename to examples/lines_bars_and_markers/xcorr_acorr_demo.py diff --git a/examples/pylab_examples/agg_buffer.py b/examples/misc/agg_buffer.py similarity index 100% rename from examples/pylab_examples/agg_buffer.py rename to examples/misc/agg_buffer.py diff --git a/examples/pylab_examples/agg_buffer_to_array.py b/examples/misc/agg_buffer_to_array.py similarity index 100% rename from examples/pylab_examples/agg_buffer_to_array.py rename to examples/misc/agg_buffer_to_array.py diff --git a/examples/pylab_examples/anchored_artists.py b/examples/misc/anchored_artists.py similarity index 100% rename from examples/pylab_examples/anchored_artists.py rename to examples/misc/anchored_artists.py diff --git a/examples/pylab_examples/coords_report.py b/examples/misc/coords_report.py similarity index 100% rename from examples/pylab_examples/coords_report.py rename to examples/misc/coords_report.py diff --git a/examples/pylab_examples/cursor_demo_sgskip.py b/examples/misc/cursor_demo_sgskip.py similarity index 100% rename from examples/pylab_examples/cursor_demo_sgskip.py rename to examples/misc/cursor_demo_sgskip.py diff --git a/examples/pylab_examples/customize_rc.py b/examples/misc/customize_rc.py similarity index 100% rename from examples/pylab_examples/customize_rc.py rename to examples/misc/customize_rc.py diff --git a/examples/pylab_examples/demo_agg_filter.py b/examples/misc/demo_agg_filter.py similarity index 100% rename from examples/pylab_examples/demo_agg_filter.py rename to examples/misc/demo_agg_filter.py diff --git a/examples/pylab_examples/demo_ribbon_box.py b/examples/misc/demo_ribbon_box.py similarity index 100% rename from examples/pylab_examples/demo_ribbon_box.py rename to examples/misc/demo_ribbon_box.py diff --git a/examples/pylab_examples/fill_spiral.py b/examples/misc/fill_spiral.py similarity index 100% rename from examples/pylab_examples/fill_spiral.py rename to examples/misc/fill_spiral.py diff --git a/examples/pylab_examples/findobj_demo.py b/examples/misc/findobj_demo.py similarity index 100% rename from examples/pylab_examples/findobj_demo.py rename to examples/misc/findobj_demo.py diff --git a/examples/pylab_examples/hyperlinks_sgskip.py b/examples/misc/hyperlinks_sgskip.py similarity index 100% rename from examples/pylab_examples/hyperlinks_sgskip.py rename to examples/misc/hyperlinks_sgskip.py diff --git a/examples/pylab_examples/load_converter.py b/examples/misc/load_converter.py similarity index 100% rename from examples/pylab_examples/load_converter.py rename to examples/misc/load_converter.py diff --git a/examples/pylab_examples/multipage_pdf.py b/examples/misc/multipage_pdf.py similarity index 100% rename from examples/pylab_examples/multipage_pdf.py rename to examples/misc/multipage_pdf.py diff --git a/examples/pylab_examples/patheffect_demo.py b/examples/misc/patheffect_demo.py similarity index 100% rename from examples/pylab_examples/patheffect_demo.py rename to examples/misc/patheffect_demo.py diff --git a/examples/pylab_examples/plotfile_demo.py b/examples/misc/plotfile_demo.py similarity index 100% rename from examples/pylab_examples/plotfile_demo.py rename to examples/misc/plotfile_demo.py diff --git a/examples/pylab_examples/print_stdout_sgskip.py b/examples/misc/print_stdout_sgskip.py similarity index 100% rename from examples/pylab_examples/print_stdout_sgskip.py rename to examples/misc/print_stdout_sgskip.py diff --git a/examples/pylab_examples/pythonic_matplotlib.py b/examples/misc/pythonic_matplotlib.py similarity index 100% rename from examples/pylab_examples/pythonic_matplotlib.py rename to examples/misc/pythonic_matplotlib.py diff --git a/examples/pylab_examples/set_and_get.py b/examples/misc/set_and_get.py similarity index 100% rename from examples/pylab_examples/set_and_get.py rename to examples/misc/set_and_get.py diff --git a/examples/pylab_examples/transoffset.py b/examples/misc/transoffset.py similarity index 100% rename from examples/pylab_examples/transoffset.py rename to examples/misc/transoffset.py diff --git a/examples/pylab_examples/webapp_demo_sgskip.py b/examples/misc/webapp_demo_sgskip.py similarity index 100% rename from examples/pylab_examples/webapp_demo_sgskip.py rename to examples/misc/webapp_demo_sgskip.py diff --git a/examples/pylab_examples/zorder_demo.py b/examples/misc/zorder_demo.py similarity index 100% rename from examples/pylab_examples/zorder_demo.py rename to examples/misc/zorder_demo.py diff --git a/examples/pylab_examples/README.txt b/examples/pylab_examples/README.txt deleted file mode 100644 index e33aefca7d0c..000000000000 --- a/examples/pylab_examples/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -.. _pylab_examples: - -Pylab Examples -============== diff --git a/examples/pylab_examples/aspect_loglog.py b/examples/scales/aspect_loglog.py similarity index 100% rename from examples/pylab_examples/aspect_loglog.py rename to examples/scales/aspect_loglog.py diff --git a/examples/pylab_examples/symlog_demo.py b/examples/scales/symlog_demo.py similarity index 100% rename from examples/pylab_examples/symlog_demo.py rename to examples/scales/symlog_demo.py diff --git a/examples/pylab_examples/hatch_demo.py b/examples/shapes_and_collections/hatch_demo.py similarity index 100% rename from examples/pylab_examples/hatch_demo.py rename to examples/shapes_and_collections/hatch_demo.py diff --git a/examples/pylab_examples/marker_path.py b/examples/shapes_and_collections/marker_path.py similarity index 100% rename from examples/pylab_examples/marker_path.py rename to examples/shapes_and_collections/marker_path.py diff --git a/examples/pylab_examples/system_monitor.py b/examples/specialty_plots/system_monitor.py similarity index 100% rename from examples/pylab_examples/system_monitor.py rename to examples/specialty_plots/system_monitor.py diff --git a/examples/pylab_examples/demo_tight_layout.py b/examples/subplots_axes_and_figures/demo_tight_layout.py similarity index 100% rename from examples/pylab_examples/demo_tight_layout.py rename to examples/subplots_axes_and_figures/demo_tight_layout.py diff --git a/examples/pylab_examples/multiple_figs_demo.py b/examples/subplots_axes_and_figures/multiple_figs_demo.py similarity index 100% rename from examples/pylab_examples/multiple_figs_demo.py rename to examples/subplots_axes_and_figures/multiple_figs_demo.py diff --git a/examples/pylab_examples/demo_text_path.py b/examples/text_labels_and_annotations/demo_text_path.py similarity index 100% rename from examples/pylab_examples/demo_text_path.py rename to examples/text_labels_and_annotations/demo_text_path.py diff --git a/examples/pylab_examples/multiline.py b/examples/text_labels_and_annotations/multiline.py similarity index 100% rename from examples/pylab_examples/multiline.py rename to examples/text_labels_and_annotations/multiline.py From 12fd56236c29bb6497dd5b5f71584fc9414b3d68 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 2 Aug 2017 21:41:55 +0100 Subject: [PATCH 2/3] PEP8 moved examples --- .../ginput_manual_clabel_sgskip.py | 2 ++ .../demo_bboximage.py | 4 ++-- .../lines_bars_and_markers/markevery_demo.py | 1 - examples/lines_bars_and_markers/nan_test.py | 1 + .../xcorr_acorr_demo.py | 7 +++---- examples/misc/anchored_artists.py | 10 +++++---- examples/misc/coords_report.py | 1 + examples/misc/cursor_demo_sgskip.py | 4 ++-- examples/misc/customize_rc.py | 2 +- examples/misc/demo_agg_filter.py | 21 +++++++------------ examples/misc/findobj_demo.py | 1 + examples/misc/patheffect_demo.py | 5 +++-- examples/misc/transoffset.py | 3 ++- examples/misc/webapp_demo_sgskip.py | 1 + examples/misc/zorder_demo.py | 12 +++++++---- examples/scales/symlog_demo.py | 3 +-- examples/shapes_and_collections/hatch_demo.py | 6 ++++-- .../demo_text_path.py | 13 +++++++----- 18 files changed, 54 insertions(+), 43 deletions(-) diff --git a/examples/event_handling/ginput_manual_clabel_sgskip.py b/examples/event_handling/ginput_manual_clabel_sgskip.py index 920d1fdcf39e..25ee40e4eb23 100644 --- a/examples/event_handling/ginput_manual_clabel_sgskip.py +++ b/examples/event_handling/ginput_manual_clabel_sgskip.py @@ -32,6 +32,7 @@ def tellme(s): ################################################## # Define a triangle by clicking three points + plt.clf() plt.axis([-1., 1., -1., 1.]) plt.setp(plt.gca(), autoscale_on=False) @@ -73,6 +74,7 @@ def f(x, y, pts): z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2)) return 1/z + X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51)) Z = f(X, Y, pts) diff --git a/examples/images_contours_and_fields/demo_bboximage.py b/examples/images_contours_and_fields/demo_bboximage.py index 54c5a80ddb41..158aa66910b0 100644 --- a/examples/images_contours_and_fields/demo_bboximage.py +++ b/examples/images_contours_and_fields/demo_bboximage.py @@ -37,7 +37,7 @@ not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps. ) - #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) + # fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) ncol = 2 nrow = len(maps)//ncol + 1 @@ -50,7 +50,7 @@ for i, m in enumerate(maps): ix, iy = divmod(i, nrow) - #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') + # plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction), 1. - iy*dy*(1 + ypad_fraction) - dy, dx, dy) diff --git a/examples/lines_bars_and_markers/markevery_demo.py b/examples/lines_bars_and_markers/markevery_demo.py index 7029ba0d86db..8141c8d4bb49 100644 --- a/examples/lines_bars_and_markers/markevery_demo.py +++ b/examples/lines_bars_and_markers/markevery_demo.py @@ -55,7 +55,6 @@ ax.append(fig1.add_subplot(gs[row, col])) ax[-1].set_title('markevery=%s' % str(case)) ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) -#fig1.tight_layout() ############################################################################### # Plot each markevery case for log x and y scales diff --git a/examples/lines_bars_and_markers/nan_test.py b/examples/lines_bars_and_markers/nan_test.py index fb026fc9195b..ad7cd6b5698c 100644 --- a/examples/lines_bars_and_markers/nan_test.py +++ b/examples/lines_bars_and_markers/nan_test.py @@ -30,4 +30,5 @@ plt.ylabel('more nans') plt.grid(True) +plt.tight_layout() plt.show() diff --git a/examples/lines_bars_and_markers/xcorr_acorr_demo.py b/examples/lines_bars_and_markers/xcorr_acorr_demo.py index d388e38495e4..3ccae86929f5 100644 --- a/examples/lines_bars_and_markers/xcorr_acorr_demo.py +++ b/examples/lines_bars_and_markers/xcorr_acorr_demo.py @@ -3,7 +3,8 @@ Cross- and Auto-Correlation Demo ================================ -Example use of cross-correlation (``xcorr``) and auto-correlation (``acorr``) plots. +Example use of cross-correlation (`xcorr`) and auto-correlation (`acorr`) +plots. """ import matplotlib.pyplot as plt import numpy as np @@ -14,13 +15,11 @@ x, y = np.random.randn(2, 100) -fig = plt.figure() -ax1 = fig.add_subplot(211) +fig, [ax1, ax2] = plt.subplots(2, 1, sharex=True) ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2) ax1.grid(True) ax1.axhline(0, color='black', lw=2) -ax2 = fig.add_subplot(212, sharex=ax1) ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2) ax2.grid(True) ax2.axhline(0, color='black', lw=2) diff --git a/examples/misc/anchored_artists.py b/examples/misc/anchored_artists.py index 5e6ebe69ba95..62d9c68fabfb 100644 --- a/examples/misc/anchored_artists.py +++ b/examples/misc/anchored_artists.py @@ -11,7 +11,8 @@ class AnchoredText(AnchoredOffsetbox): - def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): + def __init__(self, s, loc, pad=0.4, borderpad=0.5, + prop=None, frameon=True): self.txt = TextArea(s, minimumdescent=False) @@ -26,8 +27,8 @@ class AnchoredSizeBar(AnchoredOffsetbox): def __init__(self, transform, size, label, loc, pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True): """ - Draw a horizontal bar with the size in data coordinate of the give axes. - A label will be drawn underneath (center-aligned). + Draw a horizontal bar with the size in data coordinate of the given + axes. A label will be drawn underneath (center-aligned). pad, borderpad in fraction of the legend font size (or prop) sep in points. @@ -71,7 +72,8 @@ def __init__(self, width, height, xdescent, ydescent, self.da = DrawingArea(width, height, xdescent, ydescent) - super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad, + super(AnchoredDrawingArea, self).__init__(loc, pad=pad, + borderpad=borderpad, child=self.da, prop=None, frameon=frameon) diff --git a/examples/misc/coords_report.py b/examples/misc/coords_report.py index 848cc79aff9a..84ce03e09a7f 100644 --- a/examples/misc/coords_report.py +++ b/examples/misc/coords_report.py @@ -13,6 +13,7 @@ def millions(x): return '$%1.1fM' % (x*1e-6) + # Fixing random state for reproducibility np.random.seed(19680801) diff --git a/examples/misc/cursor_demo_sgskip.py b/examples/misc/cursor_demo_sgskip.py index aaa551aeb647..a9e3c68c4410 100644 --- a/examples/misc/cursor_demo_sgskip.py +++ b/examples/misc/cursor_demo_sgskip.py @@ -77,10 +77,10 @@ def mouse_move(self, event): plt.draw() t = np.arange(0.0, 1.0, 0.01) -s = np.sin(2*2*np.pi*t) +s = np.sin(2 * 2 * np.pi * t) fig, ax = plt.subplots() -#cursor = Cursor(ax) +# cursor = Cursor(ax) cursor = SnaptoCursor(ax, t, s) plt.connect('motion_notify_event', cursor.mouse_move) diff --git a/examples/misc/customize_rc.py b/examples/misc/customize_rc.py index 3226d35699b9..37bc5b8d4bc7 100644 --- a/examples/misc/customize_rc.py +++ b/examples/misc/customize_rc.py @@ -14,7 +14,7 @@ def set_pub(): rc('font', weight='bold') # bold fonts are easier to see rc('tick', labelsize=15) # tick labels bigger - rc('lines', lw=1, color='k') # thicker black lines (no budget for color!) + rc('lines', lw=1, color='k') # thicker black lines rc('grid', c='0.5', ls='-', lw=0.5) # solid gray grid lines rc('savefig', dpi=300) # higher res outputs diff --git a/examples/misc/demo_agg_filter.py b/examples/misc/demo_agg_filter.py index b146f2fa78d0..b058e242e17d 100644 --- a/examples/misc/demo_agg_filter.py +++ b/examples/misc/demo_agg_filter.py @@ -9,6 +9,9 @@ import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab +import matplotlib.transforms as mtransforms +from matplotlib.colors import LightSource +from matplotlib.artist import Artist def smooth1d(x, window_len): @@ -34,7 +37,7 @@ def smooth2d(A, sigma=3): class BaseFilter(object): def prepare_image(self, src_image, dpi, pad): ny, nx, depth = src_image.shape - #tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d") + # tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d") padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d") padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :] @@ -82,7 +85,7 @@ def get_pad(self, dpi): return int(self.sigma*3/72.*dpi) def process_image(self, padded_src, dpi): - #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) + # offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) tgt_image = np.zeros_like(padded_src) aa = smooth2d(padded_src[:, :, -1]*self.alpha, self.sigma/72.*dpi) @@ -106,9 +109,6 @@ def process_image(self, padded_src, dpi): return t2 -from matplotlib.colors import LightSource - - class LightFilter(BaseFilter): "simple gauss filter" @@ -160,9 +160,6 @@ def __call__(self, im, dpi): return new_im, offsetx, offsety -from matplotlib.artist import Artist - - class FilteredArtistList(Artist): """ A simple container to draw filtered artist. @@ -182,9 +179,6 @@ def draw(self, renderer): renderer.stop_rasterizing() -import matplotlib.transforms as mtransforms - - def filtered_text(ax): # mostly copied from contour_demo.py @@ -281,9 +275,10 @@ def drop_shadow_patches(ax): rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2) womenMeans = (25, 32, 34, 20, 25) - rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2) + rects2 = ax.bar(ind + width + 0.1, womenMeans, width, + color='y', ec="w", lw=2) - #gauss = GaussianFilter(1.5, offsets=(1,1), ) + # gauss = GaussianFilter(1.5, offsets=(1,1), ) gauss = DropShadowFilter(5, offsets=(1, 1), ) shadow = FilteredArtistList(rects1 + rects2, gauss) ax.add_artist(shadow) diff --git a/examples/misc/findobj_demo.py b/examples/misc/findobj_demo.py index 2655106f1bef..971a184a53de 100644 --- a/examples/misc/findobj_demo.py +++ b/examples/misc/findobj_demo.py @@ -29,6 +29,7 @@ def myfunc(x): return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') + for o in fig.findobj(myfunc): o.set_color('blue') diff --git a/examples/misc/patheffect_demo.py b/examples/misc/patheffect_demo.py index 1709f94f81ad..8d95b53a1970 100644 --- a/examples/misc/patheffect_demo.py +++ b/examples/misc/patheffect_demo.py @@ -15,8 +15,9 @@ txt = ax1.annotate("test", (1., 1.), (0., 0), arrowprops=dict(arrowstyle="->", connectionstyle="angle3", lw=2), - size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3, - foreground="w")]) + size=20, ha="center", + path_effects=[PathEffects.withStroke(linewidth=3, + foreground="w")]) txt.arrow_patch.set_path_effects([ PathEffects.Stroke(linewidth=5, foreground="w"), PathEffects.Normal()]) diff --git a/examples/misc/transoffset.py b/examples/misc/transoffset.py index 7cd9266fc124..127ca6bf6769 100644 --- a/examples/misc/transoffset.py +++ b/examples/misc/transoffset.py @@ -46,7 +46,8 @@ # offset_copy works for polar plots also. ax = plt.subplot(2, 1, 2, projection='polar') -trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, y=6, units='dots') +trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, + y=6, units='dots') for x, y in zip(xs, ys): plt.polar((x,), (y,), 'ro') diff --git a/examples/misc/webapp_demo_sgskip.py b/examples/misc/webapp_demo_sgskip.py index 35cf83a78bf3..8a67dfb2af93 100644 --- a/examples/misc/webapp_demo_sgskip.py +++ b/examples/misc/webapp_demo_sgskip.py @@ -60,4 +60,5 @@ def make_fig(): FigureCanvasAgg(fig).print_png('webapp.png', dpi=150) + make_fig() diff --git a/examples/misc/zorder_demo.py b/examples/misc/zorder_demo.py index 71644783cdf9..ae96571ae864 100644 --- a/examples/misc/zorder_demo.py +++ b/examples/misc/zorder_demo.py @@ -56,10 +56,14 @@ x = np.linspace(0, 2*np.pi, 100) plt.figure() -plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top -plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1) # bottom -plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3) -plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2) +plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', + zorder=10) # on top +plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', + zorder=1) # bottom +plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', + zorder=3) +plt.axhline(0, linewidth=10, color='blue', label='zorder=2', + zorder=2) plt.title('Custom order of elements') l = plt.legend() l.set_zorder(20) # put the legend on top diff --git a/examples/scales/symlog_demo.py b/examples/scales/symlog_demo.py index c655e634744d..0c27ba35e693 100644 --- a/examples/scales/symlog_demo.py +++ b/examples/scales/symlog_demo.py @@ -31,6 +31,5 @@ plt.grid(True) plt.ylabel('symlog both') -plt.subplots_adjust(hspace=0.5, left=0.2) - +plt.tight_layout() plt.show() diff --git a/examples/shapes_and_collections/hatch_demo.py b/examples/shapes_and_collections/hatch_demo.py index 01bbd1b7bc5a..2785d6d35a29 100644 --- a/examples/shapes_and_collections/hatch_demo.py +++ b/examples/shapes_and_collections/hatch_demo.py @@ -12,12 +12,14 @@ fig = plt.figure() ax1 = fig.add_subplot(131) ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/") -ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//') +ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), + color='blue', edgecolor='black', hatch='//') ax1.set_xticks([1.5, 2.5, 3.5, 4.5]) ax2 = fig.add_subplot(132) bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \ - ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black') + ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), + color='green', ecolor='black') ax2.set_xticks([1.5, 2.5, 3.5, 4.5]) patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.') diff --git a/examples/text_labels_and_annotations/demo_text_path.py b/examples/text_labels_and_annotations/demo_text_path.py index 5df9593b8632..29720da8e3f3 100644 --- a/examples/text_labels_and_annotations/demo_text_path.py +++ b/examples/text_labels_and_annotations/demo_text_path.py @@ -74,7 +74,7 @@ def draw(self, renderer=None): p = PathClippedImagePatch(text_path, arr, ec="k", transform=IdentityTransform()) - #p.set_clip_on(False) + # p.set_clip_on(False) # make offset box offsetbox = AuxTransformBox(IdentityTransform()) @@ -122,15 +122,18 @@ def draw(self, renderer=None): arr = np.arange(256).reshape(1, 256)/256. if usetex: - s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" + s = (r"$\displaystyle\left[\sum_{n=1}^\infty" + r"\frac{-e^{i\pi}}{2^n}\right]$!") else: s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" text_path = TextPath((0, 0), s, size=40, usetex=usetex) text_patch = PathClippedImagePatch(text_path, arr, ec="none", transform=IdentityTransform()) - shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3)) - shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none")) + shadow1 = mpatches.Shadow(text_patch, 1, -1, + props=dict(fc="none", ec="0.6", lw=3)) + shadow2 = mpatches.Shadow(text_patch, 1, -1, + props=dict(fc="0.3", ec="none")) # make offset box offsetbox = AuxTransformBox(IdentityTransform()) @@ -144,7 +147,7 @@ def draw(self, renderer=None): boxcoords="offset points", box_alignment=(0.5, 0.5), ) - #text_path.set_size(10) + # text_path.set_size(10) ax.add_artist(ab) From 9b66083e7833f99842267deca73054e580c12523 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 2 Aug 2017 22:05:53 +0100 Subject: [PATCH 3/3] Fix broken doc links --- doc/faq/howto_faq.rst | 2 +- doc/users/prev_whats_new/whats_new_1.3.rst | 8 ++++---- lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/collections.py | 2 +- lib/matplotlib/dates.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/faq/howto_faq.rst b/doc/faq/howto_faq.rst index b1e1eb4890bb..0090bbe19a66 100644 --- a/doc/faq/howto_faq.rst +++ b/doc/faq/howto_faq.rst @@ -340,7 +340,7 @@ and patches, respectively:: .. htmlonly:: - See :ref:`sphx_glr_gallery_pylab_examples_zorder_demo.py` for a complete example. + See :ref:`sphx_glr_gallery_misc_zorder_demo.py` for a complete example. You can also use the Axes property :meth:`~matplotlib.axes.Axes.set_axisbelow` to control whether the grid diff --git a/doc/users/prev_whats_new/whats_new_1.3.rst b/doc/users/prev_whats_new/whats_new_1.3.rst index 04392bad099a..2f7aba728851 100644 --- a/doc/users/prev_whats_new/whats_new_1.3.rst +++ b/doc/users/prev_whats_new/whats_new_1.3.rst @@ -117,8 +117,8 @@ New eventplot plot type Todd Jennings added a :func:`~matplotlib.pyplot.eventplot` function to create multiple rows or columns of identical line segments -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_eventplot_demo_001.png - :target: ../../gallery/pylab_examples/eventplot_demo.html +.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_eventplot_demo_001.png + :target: ../../gallery/lines_bars_and_markers/eventplot_demo.html :align: center :scale: 50 @@ -199,8 +199,8 @@ Path effects on lines ````````````````````` Thanks to Jae-Joon Lee, path effects now also work on plot lines. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_patheffect_demo_001.png - :target: ../../gallery/pylab_examples/patheffect_demo.html +.. figure:: ../../gallery/misc/images/sphx_glr_patheffect_demo_001.png + :target: ../../gallery/misc/patheffect_demo.html :align: center :scale: 50 diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index fc28d59a6a1b..bddf37e018c2 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1160,7 +1160,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1, Examples -------- - .. plot:: mpl_examples/pylab_examples/eventplot_demo.py + .. plot:: mpl_examples/lines_bars_and_markers/eventplot_demo.py """ self._process_unit_info(xdata=positions, ydata=[lineoffsets, linelengths], diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 52543e60076b..66a6a58d94ab 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -1303,7 +1303,7 @@ def __init__(self, Examples -------- - .. plot:: mpl_examples/pylab_examples/eventcollection_demo.py + .. plot:: mpl_examples/lines_bars_and_markers/eventcollection_demo.py """ segment = (lineoffset + linelength / 2., diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 7b9aa834bc99..226f491d97ff 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -291,7 +291,7 @@ class bytespdate2num(strpdate2num): """ Use this class to parse date strings to matplotlib datenums when you know the date format string of the date you are parsing. See - :file:`examples/pylab_examples/load_converter.py`. + :file:`examples/misc/load_converter.py`. """ def __init__(self, fmt, encoding='utf-8'): """