From 93199703ed6b7b8526eff94f28a7061d43fcbb11 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 1 Jul 2017 16:10:08 +0100 Subject: [PATCH 1/7] Move pylab examples referenced in tutorials --- .../{pylab_examples => lines_bars_and_markers}/simple_plot.py | 0 examples/{pylab_examples => misc}/table_demo.py | 0 examples/{pylab_examples => pie_and_polar_charts}/polar_demo.py | 0 examples/{pylab_examples => scales}/log_demo.py | 0 .../{pylab_examples => shapes_and_collections}/ellipse_demo.py | 0 .../{pylab_examples => shapes_and_collections}/fancybox_demo.py | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename examples/{pylab_examples => lines_bars_and_markers}/simple_plot.py (100%) rename examples/{pylab_examples => misc}/table_demo.py (100%) rename examples/{pylab_examples => pie_and_polar_charts}/polar_demo.py (100%) rename examples/{pylab_examples => scales}/log_demo.py (100%) rename examples/{pylab_examples => shapes_and_collections}/ellipse_demo.py (100%) rename examples/{pylab_examples => shapes_and_collections}/fancybox_demo.py (100%) diff --git a/examples/pylab_examples/simple_plot.py b/examples/lines_bars_and_markers/simple_plot.py similarity index 100% rename from examples/pylab_examples/simple_plot.py rename to examples/lines_bars_and_markers/simple_plot.py diff --git a/examples/pylab_examples/table_demo.py b/examples/misc/table_demo.py similarity index 100% rename from examples/pylab_examples/table_demo.py rename to examples/misc/table_demo.py diff --git a/examples/pylab_examples/polar_demo.py b/examples/pie_and_polar_charts/polar_demo.py similarity index 100% rename from examples/pylab_examples/polar_demo.py rename to examples/pie_and_polar_charts/polar_demo.py diff --git a/examples/pylab_examples/log_demo.py b/examples/scales/log_demo.py similarity index 100% rename from examples/pylab_examples/log_demo.py rename to examples/scales/log_demo.py diff --git a/examples/pylab_examples/ellipse_demo.py b/examples/shapes_and_collections/ellipse_demo.py similarity index 100% rename from examples/pylab_examples/ellipse_demo.py rename to examples/shapes_and_collections/ellipse_demo.py diff --git a/examples/pylab_examples/fancybox_demo.py b/examples/shapes_and_collections/fancybox_demo.py similarity index 100% rename from examples/pylab_examples/fancybox_demo.py rename to examples/shapes_and_collections/fancybox_demo.py From bd8cb1e93c856fa3b08edb526337879d6ec49ef0 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 1 Jul 2017 16:10:37 +0100 Subject: [PATCH 2/7] Clean and fix links in moved examples --- .../lines_bars_and_markers/simple_plot.py | 2 +- examples/misc/table_demo.py | 12 +++++------ examples/pie_and_polar_charts/polar_demo.py | 4 ++-- examples/scales/log_demo.py | 8 ++++---- .../shapes_and_collections/ellipse_demo.py | 4 ++-- .../shapes_and_collections/fancybox_demo.py | 17 ++++++++-------- tutorials/01_introductory/sample_plots.py | 20 +++++++++---------- tutorials/text/annotations.py | 4 ++-- 8 files changed, 36 insertions(+), 35 deletions(-) diff --git a/examples/lines_bars_and_markers/simple_plot.py b/examples/lines_bars_and_markers/simple_plot.py index b64d80737c00..4aed2f40cb55 100644 --- a/examples/lines_bars_and_markers/simple_plot.py +++ b/examples/lines_bars_and_markers/simple_plot.py @@ -10,7 +10,7 @@ # Data for plotting t = np.arange(0.0, 2.0, 0.01) -s = 1 + np.sin(2*np.pi*t) +s = 1 + np.sin(2 * np.pi * t) # Note that using plt.subplots below is equivalent to using # fig = plt.figure and then ax = fig.add_subplot(111) diff --git a/examples/misc/table_demo.py b/examples/misc/table_demo.py index fdf5998418c0..936d0d3a9e84 100644 --- a/examples/misc/table_demo.py +++ b/examples/misc/table_demo.py @@ -9,11 +9,11 @@ import matplotlib.pyplot as plt -data = [[ 66386, 174296, 75131, 577908, 32015], - [ 58230, 381139, 78045, 99308, 160454], - [ 89135, 80552, 152558, 497981, 603535], - [ 78415, 81858, 150656, 193263, 69638], - [ 139361, 331509, 343164, 781380, 52269]] +data = [[66386, 174296, 75131, 577908, 32015], + [58230, 381139, 78045, 99308, 160454], + [89135, 80552, 152558, 497981, 603535], + [78415, 81858, 150656, 193263, 69638], + [139361, 331509, 343164, 781380, 52269]] columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail') rows = ['%d year' % x for x in (100, 50, 20, 10, 5)] @@ -36,7 +36,7 @@ for row in range(n_rows): plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row]) y_offset = y_offset + data[row] - cell_text.append(['%1.1f' % (x/1000.0) for x in y_offset]) + cell_text.append(['%1.1f' % (x / 1000.0) for x in y_offset]) # Reverse colors and text labels to display the last value at the top. colors = colors[::-1] cell_text.reverse() diff --git a/examples/pie_and_polar_charts/polar_demo.py b/examples/pie_and_polar_charts/polar_demo.py index daa60ea734a7..eb89d19c92cb 100644 --- a/examples/pie_and_polar_charts/polar_demo.py +++ b/examples/pie_and_polar_charts/polar_demo.py @@ -15,8 +15,8 @@ ax = plt.subplot(111, projection='polar') ax.plot(theta, r) ax.set_rmax(2) -ax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks -ax.set_rlabel_position(-22.5) # get radial labels away from plotted line +ax.set_rticks([0.5, 1, 1.5, 2]) # Less radial ticks +ax.set_rlabel_position(-22.5) # Move radial labels away from plotted line ax.grid(True) ax.set_title("A line plot on a polar axis", va='bottom') diff --git a/examples/scales/log_demo.py b/examples/scales/log_demo.py index 3277be877348..192873aeb3c6 100644 --- a/examples/scales/log_demo.py +++ b/examples/scales/log_demo.py @@ -20,17 +20,17 @@ fig.subplots_adjust(hspace=0.5) # log y axis -ax1.semilogy(t, np.exp(-t/5.0)) +ax1.semilogy(t, np.exp(-t / 5.0)) ax1.set(title='semilogy') ax1.grid() # log x axis -ax2.semilogx(t, np.sin(2*np.pi*t)) +ax2.semilogx(t, np.sin(2 * np.pi * t)) ax2.set(title='semilogx') ax2.grid() # log x and y axis -ax3.loglog(t, 20*np.exp(-t/10.0), basex=2) +ax3.loglog(t, 20 * np.exp(-t / 10.0), basex=2) ax3.set(title='loglog base 2 on x') ax3.grid() @@ -42,7 +42,7 @@ ax4.set_xscale("log", nonposx='clip') ax4.set_yscale("log", nonposy='clip') ax4.set(title='Errorbars go negative') -ax4.errorbar(x, y, xerr=0.1*x, yerr=5.0 + 0.75*y) +ax4.errorbar(x, y, xerr=0.1 * x, yerr=5.0 + 0.75 * y) # ylim must be set after errorbar to allow errorbar to autoscale limits ax4.set_ylim(ymin=0.1) diff --git a/examples/shapes_and_collections/ellipse_demo.py b/examples/shapes_and_collections/ellipse_demo.py index 7830a1c080c2..3fd33d9afdf0 100644 --- a/examples/shapes_and_collections/ellipse_demo.py +++ b/examples/shapes_and_collections/ellipse_demo.py @@ -10,9 +10,9 @@ NUM = 250 -ells = [Ellipse(xy=np.random.rand(2)*10, +ells = [Ellipse(xy=np.random.rand(2) * 10, width=np.random.rand(), height=np.random.rand(), - angle=np.random.rand()*360) + angle=np.random.rand() * 360) for i in range(NUM)] fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'}) diff --git a/examples/shapes_and_collections/fancybox_demo.py b/examples/shapes_and_collections/fancybox_demo.py index 9d5465d51f2e..e1dc1eb451e0 100644 --- a/examples/shapes_and_collections/fancybox_demo.py +++ b/examples/shapes_and_collections/fancybox_demo.py @@ -20,7 +20,7 @@ spacing = 1.2 figheight = (spacing * len(styles) + .5) -fig1 = plt.figure(1, (4/1.5, figheight/1.5)) +fig1 = plt.figure(1, (4 / 1.5, figheight / 1.5)) fontsize = 0.3 * 72 for i, stylename in enumerate(sorted(styles)): @@ -65,8 +65,8 @@ def test1(ax): size=10, transform=ax.transAxes) # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") + # l = p_fancy.get_path().vertices + # ax.plot(l[:,0], l[:,1], ".") # draw the original bbox in black draw_bbox(ax, bb) @@ -90,15 +90,15 @@ def test2(ax): p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2") # or - #p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) + # p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) ax.text(0.1, 0.8, ' boxstyle="round,pad=0.1\n rounding_size=0.2"', size=10, transform=ax.transAxes) # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") + # l = p_fancy.get_path().vertices + # ax.plot(l[:,0], l[:,1], ".") draw_bbox(ax, bb) @@ -122,8 +122,8 @@ def test3(ax): size=10, transform=ax.transAxes) # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") + # l = p_fancy.get_path().vertices + # ax.plot(l[:,0], l[:,1], ".") draw_bbox(ax, bb) @@ -192,4 +192,5 @@ def test_all(): plt.draw() plt.show() + test_all() diff --git a/tutorials/01_introductory/sample_plots.py b/tutorials/01_introductory/sample_plots.py index c4fedcbc4cbd..eaad1e3fd6ef 100644 --- a/tutorials/01_introductory/sample_plots.py +++ b/tutorials/01_introductory/sample_plots.py @@ -14,8 +14,8 @@ Here's how to create a line plot with text labels using :func:`~matplotlib.pyplot.plot`. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_simple_plot_001.png - :target: ../../gallery/pylab_examples/simple_plot.html +.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_simple_plot_001.png + :target: ../../gallery/lines_bars_and_markers/simple_plot.html :align: center :scale: 50 @@ -120,8 +120,8 @@ accurate 8-spline approximation to elliptical arcs (see :class:`~matplotlib.patches.Arc`), which are insensitive to zoom level. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_ellipse_demo_001.png - :target: ../../gallery/pylab_examples/ellipse_demo.html +.. figure:: ../../gallery/shapes_and_collections/images/sphx_glr_ellipse_demo_001.png + :target: ../../gallery/shapes_and_collections/ellipse_demo.html :align: center :scale: 50 @@ -174,8 +174,8 @@ The :func:`~matplotlib.pyplot.table` command adds a text table to an axes. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_table_demo_001.png - :target: ../../gallery/pylab_examples/table_demo.html +.. figure:: ../../gallery/misc/images/sphx_glr_table_demo_001.png + :target: ../../gallery/misc/table_demo.html :align: center :scale: 50 @@ -265,8 +265,8 @@ :func:`~matplotlib.pyplot.loglog` functions simplify the creation of logarithmic plots. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_log_demo_001.png - :target: ../../gallery/pylab_examples/log_demo.html +.. figure:: ../../gallery/scales/images/sphx_glr_log_demo_001.png + :target: ../../gallery/scales/log_demo.html :align: center :scale: 50 @@ -282,8 +282,8 @@ The :func:`~matplotlib.pyplot.polar` command generates polar plots. -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_polar_demo_001.png - :target: ../../gallery/pylab_examples/polar_demo.html +.. figure:: ../../gallery/pie_and_polar_charts/images/sphx_glr_polar_demo_001.png + :target: ../../gallery/pie_and_polar_charts/polar_demo.html :align: center :scale: 50 diff --git a/tutorials/text/annotations.py b/tutorials/text/annotations.py index 0bf520681de6..2b839415a610 100644 --- a/tutorials/text/annotations.py +++ b/tutorials/text/annotations.py @@ -158,8 +158,8 @@ Square ``square`` pad=0.3 ========== ============== ========================== -.. figure:: ../../gallery/pylab_examples/images/sphx_glr_fancybox_demo_001.png - :target: ../../gallery/pylab_examples/fancybox_demo.html +.. figure:: ../../gallery/shapes_and_collections/images/sphx_glr_fancybox_demo_001.png + :target: ../../gallery/shapes_and_collections/fancybox_demo.html :align: center :scale: 50 From caff8e208183a310ddc485b8f13333d263b9f368 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 1 Jul 2017 16:26:32 +0100 Subject: [PATCH 3/7] Pylab moves an cleans --- .../pie_demo2.py | 3 +- .../polar_legend.py | 4 +- .../{pylab_examples => scales}/log_bar.py | 12 +++-- .../{pylab_examples => scales}/log_test.py | 0 .../ellipse_collection.py | 6 +-- .../ellipse_rotated.py | 0 .../leftventricle_bulleye.py | 44 +++++++++---------- .../mri_demo.py | 0 .../mri_with_eeg.py | 0 .../figlegend_demo.py | 6 +-- .../usetex_fonteffects.py | 4 +- .../major_minor_demo.py | 4 +- 12 files changed, 42 insertions(+), 41 deletions(-) rename examples/{pylab_examples => pie_and_polar_charts}/pie_demo2.py (98%) rename examples/{pylab_examples => pie_and_polar_charts}/polar_legend.py (85%) rename examples/{pylab_examples => scales}/log_bar.py (60%) rename examples/{pylab_examples => scales}/log_test.py (100%) rename examples/{pylab_examples => shapes_and_collections}/ellipse_collection.py (93%) rename examples/{pylab_examples => shapes_and_collections}/ellipse_rotated.py (100%) rename examples/{pylab_examples => specialty_plots}/leftventricle_bulleye.py (86%) rename examples/{pylab_examples => specialty_plots}/mri_demo.py (100%) rename examples/{pylab_examples => specialty_plots}/mri_with_eeg.py (100%) rename examples/{pylab_examples => text_labels_and_annotations}/figlegend_demo.py (88%) rename examples/{pylab_examples => text_labels_and_annotations}/usetex_fonteffects.py (87%) rename examples/{pylab_examples => ticks_and_spines}/major_minor_demo.py (96%) diff --git a/examples/pylab_examples/pie_demo2.py b/examples/pie_and_polar_charts/pie_demo2.py similarity index 98% rename from examples/pylab_examples/pie_demo2.py rename to examples/pie_and_polar_charts/pie_demo2.py index 796b39236bba..8761a93aa752 100644 --- a/examples/pylab_examples/pie_demo2.py +++ b/examples/pie_and_polar_charts/pie_demo2.py @@ -4,7 +4,8 @@ ========= Make a pie charts of varying size - see -http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring. +http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the +docstring. This example shows a basic pie charts with labels optional features, like autolabeling the percentage, offsetting a slice with "explode" diff --git a/examples/pylab_examples/polar_legend.py b/examples/pie_and_polar_charts/polar_legend.py similarity index 85% rename from examples/pylab_examples/polar_legend.py rename to examples/pie_and_polar_charts/polar_legend.py index 8316c3db1e13..5b87c2b8d3e8 100644 --- a/examples/pylab_examples/polar_legend.py +++ b/examples/pie_and_polar_charts/polar_legend.py @@ -19,9 +19,9 @@ projection='polar', facecolor='#d5de9c') r = np.arange(0, 3.0, 0.01) -theta = 2*np.pi*r +theta = 2 * np.pi * r ax.plot(theta, r, color='#ee8d18', lw=3, label='a line') -ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line') +ax.plot(0.5 * theta, r, color='blue', ls='--', lw=3, label='another line') ax.legend() show() diff --git a/examples/pylab_examples/log_bar.py b/examples/scales/log_bar.py similarity index 60% rename from examples/pylab_examples/log_bar.py rename to examples/scales/log_bar.py index 8d3a0b746a32..b345a9ca33ee 100644 --- a/examples/pylab_examples/log_bar.py +++ b/examples/scales/log_bar.py @@ -3,26 +3,24 @@ Log Bar ======= +Plotting a bar chart with a logarithmic y-axis. """ import matplotlib.pyplot as plt import numpy as np data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) -plt.xlabel("FOO") -plt.ylabel("FOO") -plt.title("Testing") -plt.yscale('log') - dim = len(data[0]) w = 0.75 dimw = w / dim +fig, ax = plt.subplots() x = np.arange(len(data)) for i in range(len(data[0])): y = [d[i] for d in data] - b = plt.bar(x + i * dimw, y, dimw, bottom=0.001) + b = ax.bar(x + i * dimw, y, dimw, bottom=0.001) -plt.xticks(x + dimw / 2, map(str, x)) +ax.set_xticks(x + dimw / 2, map(str, x)) +ax.set_yscale('log') plt.show() diff --git a/examples/pylab_examples/log_test.py b/examples/scales/log_test.py similarity index 100% rename from examples/pylab_examples/log_test.py rename to examples/scales/log_test.py diff --git a/examples/pylab_examples/ellipse_collection.py b/examples/shapes_and_collections/ellipse_collection.py similarity index 93% rename from examples/pylab_examples/ellipse_collection.py rename to examples/shapes_and_collections/ellipse_collection.py index c23cd073d535..0ca477255b2e 100644 --- a/examples/pylab_examples/ellipse_collection.py +++ b/examples/shapes_and_collections/ellipse_collection.py @@ -14,9 +14,9 @@ XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis])) -ww = X/10.0 -hh = Y/15.0 -aa = X*9 +ww = X / 10.0 +hh = Y / 15.0 +aa = X * 9 fig, ax = plt.subplots() diff --git a/examples/pylab_examples/ellipse_rotated.py b/examples/shapes_and_collections/ellipse_rotated.py similarity index 100% rename from examples/pylab_examples/ellipse_rotated.py rename to examples/shapes_and_collections/ellipse_rotated.py diff --git a/examples/pylab_examples/leftventricle_bulleye.py b/examples/specialty_plots/leftventricle_bulleye.py similarity index 86% rename from examples/pylab_examples/leftventricle_bulleye.py rename to examples/specialty_plots/leftventricle_bulleye.py index bedec81281f2..9269c007b9d4 100644 --- a/examples/pylab_examples/leftventricle_bulleye.py +++ b/examples/specialty_plots/leftventricle_bulleye.py @@ -54,7 +54,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): if norm is None: norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max()) - theta = np.linspace(0, 2*np.pi, 768) + theta = np.linspace(0, 2 * np.pi, 768) r = np.linspace(0.2, 1, 4) # Create the bound for the segment 17 @@ -76,52 +76,52 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T for i in range(6): # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + np.deg2rad(60) + theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60) theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i] + z = np.ones((128, 2)) * data[i] ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+1 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1) + if i + 1 in segBold: + ax.plot(theta0, r0, '-k', lw=linewidth + 2) + ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth + 1) + ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth + 1) # Fill the segments 7-12 r0 = r[1:3] r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T for i in range(6): # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + np.deg2rad(60) + theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60) theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i+6] + z = np.ones((128, 2)) * data[i + 6] ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+7 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1) + if i + 7 in segBold: + ax.plot(theta0, r0, '-k', lw=linewidth + 2) + ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth + 1) + ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth + 1) # Fill the segments 13-16 r0 = r[0:2] r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T for i in range(4): # First segment start at 45 degrees - theta0 = theta[i*192:i*192+192] + np.deg2rad(45) + theta0 = theta[i * 192:i * 192 + 192] + np.deg2rad(45) theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((192, 2))*data[i+12] + z = np.ones((192, 2)) * data[i + 12] ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+13 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1) + if i + 13 in segBold: + ax.plot(theta0, r0, '-k', lw=linewidth + 2) + ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth + 1) + ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth + 1) # Fill the segments 17 if data.size == 17: r0 = np.array([0, r[0]]) r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1) - z = np.ones((theta.size, 2))*data[16] + z = np.ones((theta.size, 2)) * data[16] ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) if 17 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) + ax.plot(theta0, r0, '-k', lw=linewidth + 2) ax.set_ylim([0, 1]) ax.set_yticklabels([]) @@ -188,7 +188,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3, # to use 'extend', you must # specify two extra boundaries: - boundaries=[0]+bounds+[18], + boundaries=[0] + bounds + [18], extend='both', ticks=bounds, # optional spacing='proportional', diff --git a/examples/pylab_examples/mri_demo.py b/examples/specialty_plots/mri_demo.py similarity index 100% rename from examples/pylab_examples/mri_demo.py rename to examples/specialty_plots/mri_demo.py diff --git a/examples/pylab_examples/mri_with_eeg.py b/examples/specialty_plots/mri_with_eeg.py similarity index 100% rename from examples/pylab_examples/mri_with_eeg.py rename to examples/specialty_plots/mri_with_eeg.py diff --git a/examples/pylab_examples/figlegend_demo.py b/examples/text_labels_and_annotations/figlegend_demo.py similarity index 88% rename from examples/pylab_examples/figlegend_demo.py rename to examples/text_labels_and_annotations/figlegend_demo.py index ddb52d550e81..b8410d228e24 100644 --- a/examples/pylab_examples/figlegend_demo.py +++ b/examples/text_labels_and_annotations/figlegend_demo.py @@ -13,12 +13,12 @@ fig, axs = plt.subplots(1, 2) x = np.arange(0.0, 2.0, 0.02) -y1 = np.sin(2*np.pi*x) +y1 = np.sin(2 * np.pi * x) y2 = np.exp(-x) l1, l2 = axs[0].plot(x, y1, 'rs-', x, y2, 'go') -y3 = np.sin(4*np.pi*x) -y4 = np.exp(-2*x) +y3 = np.sin(4 * np.pi * x) +y4 = np.exp(-2 * x) l3, l4 = axs[1].plot(x, y3, 'yd-', x, y4, 'k^') fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') diff --git a/examples/pylab_examples/usetex_fonteffects.py b/examples/text_labels_and_annotations/usetex_fonteffects.py similarity index 87% rename from examples/pylab_examples/usetex_fonteffects.py rename to examples/text_labels_and_annotations/usetex_fonteffects.py index 8edf8e0b763c..8027a9166062 100644 --- a/examples/pylab_examples/usetex_fonteffects.py +++ b/examples/text_labels_and_annotations/usetex_fonteffects.py @@ -15,8 +15,10 @@ def setfont(font): return r'\font\a %s at 14pt\a ' % font + for y, font, text in zip(range(5), - ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'], + ['ptmr8r', 'ptmri8r', 'ptmro8r', + 'ptmr8rn', 'ptmrr8re'], ['Nimbus Roman No9 L ' + x for x in ['', 'Italics (real italics for comparison)', '(slanted)', '(condensed)', '(extended)']]): diff --git a/examples/pylab_examples/major_minor_demo.py b/examples/ticks_and_spines/major_minor_demo.py similarity index 96% rename from examples/pylab_examples/major_minor_demo.py rename to examples/ticks_and_spines/major_minor_demo.py index d5f0b5b869ae..3c60c367c897 100644 --- a/examples/pylab_examples/major_minor_demo.py +++ b/examples/ticks_and_spines/major_minor_demo.py @@ -44,7 +44,7 @@ t = np.arange(0.0, 100.0, 0.1) -s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01) +s = np.sin(0.1 * np.pi * t) * np.exp(-t * 0.01) fig, ax = plt.subplots() ax.plot(t, s) @@ -73,7 +73,7 @@ t = np.arange(0.0, 100.0, 0.01) -s = np.sin(2*np.pi*t)*np.exp(-t*0.01) +s = np.sin(2 * np.pi * t) * np.exp(-t * 0.01) fig, ax = plt.subplots() ax.plot(t, s) From 4aab8755f116beb38f7953ae5aca550493d847c6 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 1 Jul 2017 16:53:12 +0100 Subject: [PATCH 4/7] Fix docstring link --- lib/matplotlib/ticker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 36b30c39ac9d..65a23537b58a 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -163,7 +163,7 @@ ax.yaxis.set_major_formatter( ymajorFormatter ) ax.yaxis.set_minor_formatter( yminorFormatter ) -See :ref:`sphx_glr_gallery_pylab_examples_major_minor_demo.py` for an +See :ref:`sphx_glr_gallery_ticks_and_spines_major_minor_demo.py` for an example of setting major and minor ticks. See the :mod:`matplotlib.dates` module for more information and examples of using date locators and formatters. """ From 0b6fd236ae8191976ec7057e05b32706025f5f50 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 10 Jul 2017 20:48:10 +0100 Subject: [PATCH 5/7] Fix pep8 exception --- pytest.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pytest.ini b/pytest.ini index a2cdc0c95ae0..5fbf22e5f877 100644 --- a/pytest.ini +++ b/pytest.ini @@ -115,10 +115,10 @@ pep8ignore = tutorials/* E402 E501 *examples/* E501 E402 - *examples/pylab_examples/table_demo.py E201 - *examples/images_contours_and_fields/tricontour_demo.py E201 - *examples/images_contours_and_fields/tripcolor_demo.py E201 - *examples/images_contours_and_fields/triplot_demo.py E201 + *examples/misc/table_demo.py E201 + *examples/pylab_examples/tricontour_demo.py E201 + *examples/pylab_examples/tripcolor_demo.py E201 + *examples/pylab_examples/triplot_demo.py E201 *examples/pyplots/align_ylabels.py E231 *examples/pyplots/annotate_transform.py E228 E251 *examples/pyplots/annotation_basic.py E231 From c7d1a6eb45946d22a77477eb6f210ed6221edc61 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 10 Jul 2017 18:25:57 +0100 Subject: [PATCH 6/7] Small fixes --- examples/misc/table_demo.py | 10 +++++----- examples/pie_and_polar_charts/pie_demo2.py | 2 +- examples/scales/log_bar.py | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/misc/table_demo.py b/examples/misc/table_demo.py index 936d0d3a9e84..6b29df44b755 100644 --- a/examples/misc/table_demo.py +++ b/examples/misc/table_demo.py @@ -9,11 +9,11 @@ import matplotlib.pyplot as plt -data = [[66386, 174296, 75131, 577908, 32015], - [58230, 381139, 78045, 99308, 160454], - [89135, 80552, 152558, 497981, 603535], - [78415, 81858, 150656, 193263, 69638], - [139361, 331509, 343164, 781380, 52269]] +data = [[ 66386, 174296, 75131, 577908, 32015], + [ 58230, 381139, 78045, 99308, 160454], + [ 89135, 80552, 152558, 497981, 603535], + [ 78415, 81858, 150656, 193263, 69638], + [139361, 331509, 343164, 781380, 52269]] columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail') rows = ['%d year' % x for x in (100, 50, 20, 10, 5)] diff --git a/examples/pie_and_polar_charts/pie_demo2.py b/examples/pie_and_polar_charts/pie_demo2.py index 8761a93aa752..f5c4dae4cf74 100644 --- a/examples/pie_and_polar_charts/pie_demo2.py +++ b/examples/pie_and_polar_charts/pie_demo2.py @@ -4,7 +4,7 @@ ========= Make a pie charts of varying size - see -http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the +https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring. This example shows a basic pie charts with labels optional features, diff --git a/examples/scales/log_bar.py b/examples/scales/log_bar.py index b345a9ca33ee..77110b3620b8 100644 --- a/examples/scales/log_bar.py +++ b/examples/scales/log_bar.py @@ -23,4 +23,7 @@ ax.set_xticks(x + dimw / 2, map(str, x)) ax.set_yscale('log') +ax.set_xlabel('x') +ax.set_ylabel('y') + plt.show() From bb07ab0016ad19a369d95b50b95ffcf2ea13c842 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 24 Jul 2017 08:57:20 +0100 Subject: [PATCH 7/7] Update pytest exceptions --- pytest.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytest.ini b/pytest.ini index 5fbf22e5f877..0928004accd6 100644 --- a/pytest.ini +++ b/pytest.ini @@ -116,9 +116,9 @@ pep8ignore = *examples/* E501 E402 *examples/misc/table_demo.py E201 - *examples/pylab_examples/tricontour_demo.py E201 - *examples/pylab_examples/tripcolor_demo.py E201 - *examples/pylab_examples/triplot_demo.py E201 + *examples/images_contours_and_fields/tricontour_demo.py E201 + *examples/images_contours_and_fields/tripcolor_demo.py E201 + *examples/images_contours_and_fields/triplot_demo.py E201 *examples/pyplots/align_ylabels.py E231 *examples/pyplots/annotate_transform.py E228 E251 *examples/pyplots/annotation_basic.py E231