From 758862dad1f18f151a0942637ebb74ce26b38607 Mon Sep 17 00:00:00 2001 From: yinleon Date: Mon, 6 Mar 2017 18:02:31 -0800 Subject: [PATCH 1/5] changes for MEP12/sphinx-gallery compliance --- examples/axisartist/demo_axisline_style.py | 11 +++++++++++ examples/event_handling/keypress_demo.py | 4 ++++ examples/event_handling/pipong.py | 9 ++++++--- examples/event_handling/poly_editor.py | 4 ++++ examples/event_handling/resample.py | 11 +++++++++-- examples/mplot3d/lines3d.py | 2 +- examples/mplot3d/mixed_subplots.py | 2 +- examples/mplot3d/offset.py | 6 +++--- examples/pylab_examples/bar_stacked.py | 9 +++++++++ examples/pylab_examples/dolphin.py | 8 ++++++++ examples/pylab_examples/fill_between_demo.py | 8 ++++++++ examples/pylab_examples/geo_demo.py | 9 +++++++++ examples/pylab_examples/log_test.py | 8 ++++++++ examples/pylab_examples/mri_demo.py | 9 ++++++++- 14 files changed, 89 insertions(+), 11 deletions(-) diff --git a/examples/axisartist/demo_axisline_style.py b/examples/axisartist/demo_axisline_style.py index a8e2c7ada5d7..6c21987a8052 100644 --- a/examples/axisartist/demo_axisline_style.py +++ b/examples/axisartist/demo_axisline_style.py @@ -1,3 +1,10 @@ +""" +================ +Axis Line Styles +================ + +This example shows some configurations for axis style. +""" from mpl_toolkits.axisartist.axislines import SubplotZero import matplotlib.pyplot as plt @@ -9,10 +16,14 @@ fig.add_subplot(ax) for direction in ["xzero", "yzero"]: + # adds arrows at the ends of each axis ax.axis[direction].set_axisline_style("-|>") + + # adds X and Y-axis from the origin ax.axis[direction].set_visible(True) for direction in ["left", "right", "bottom", "top"]: + # hides boarders ax.axis[direction].set_visible(False) x = np.linspace(-0.5, 1., 100) diff --git a/examples/event_handling/keypress_demo.py b/examples/event_handling/keypress_demo.py index e36eda6bfb72..aa0a4d249c47 100644 --- a/examples/event_handling/keypress_demo.py +++ b/examples/event_handling/keypress_demo.py @@ -1,4 +1,8 @@ """ +========= +Key Press +========= + Show how to connect to keypress events """ from __future__ import print_function diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index 89ab36ef9b36..06307d57561c 100644 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -1,7 +1,10 @@ -# A matplotlib based game of Pong illustrating one way to write interactive -# animation which are easily ported to multiple backends -# pipong.py was written by Paul Ivanov +""" +==== +PONG +==== +A matplotlib based game of Pong illustrating one way to write interactive animation which are easily ported to multiple backends pipong.py was written by Paul Ivanov +""" from __future__ import print_function import numpy as np diff --git a/examples/event_handling/poly_editor.py b/examples/event_handling/poly_editor.py index df95a95d11fe..09e9ee2fc451 100644 --- a/examples/event_handling/poly_editor.py +++ b/examples/event_handling/poly_editor.py @@ -1,4 +1,8 @@ """ +=========== +Poly Editor +========== + This is an example to show how to build cross-GUI applications using matplotlib event handling to interact with objects on the canvas diff --git a/examples/event_handling/resample.py b/examples/event_handling/resample.py index 1b380a06cb96..d1b1654f1b30 100644 --- a/examples/event_handling/resample.py +++ b/examples/event_handling/resample.py @@ -1,13 +1,20 @@ +""" +=============== +Resampling Data +=============== + +Downsampling lowers the sample rate or sample size of a signal. In this tutorial, the signal is downsampled when the plot is adjusted through dragging and zooming. +""" + import numpy as np import matplotlib.pyplot as plt - # A class that will downsample the data and recompute when zoomed. class DataDisplayDownsampler(object): def __init__(self, xdata, ydata): self.origYData = ydata self.origXData = xdata - self.ratio = 5 + self.ratio = 50 self.delta = xdata[-1] - xdata[0] def downsample(self, xstart, xend): diff --git a/examples/mplot3d/lines3d.py b/examples/mplot3d/lines3d.py index a1504de63e22..444eed2d4c8e 100644 --- a/examples/mplot3d/lines3d.py +++ b/examples/mplot3d/lines3d.py @@ -3,7 +3,7 @@ 3D parametric curve =================== -Demonstrating plotting a parametric curve in 3D. +This example demonstrates plotting a parametric curve in 3D. ''' import matplotlib as mpl diff --git a/examples/mplot3d/mixed_subplots.py b/examples/mplot3d/mixed_subplots.py index 00d691813485..5e840d67df71 100644 --- a/examples/mplot3d/mixed_subplots.py +++ b/examples/mplot3d/mixed_subplots.py @@ -3,7 +3,7 @@ 2D and 3D subplots ================== -Demonstrate the mixing of 2d and 3d subplots. +This example shows a how to plot a 2D and 3D plot on the same figure. """ from mpl_toolkits.mplot3d import Axes3D diff --git a/examples/mplot3d/offset.py b/examples/mplot3d/offset.py index a92757cd9d96..da846c8cc26a 100644 --- a/examples/mplot3d/offset.py +++ b/examples/mplot3d/offset.py @@ -1,7 +1,7 @@ ''' -=================== -Offset text display -=================== +========================= +Automatic Text Offsetting +========================= This example demonstrates mplot3d's offset text display. As one rotates the 3D figure, the offsets should remain oriented the diff --git a/examples/pylab_examples/bar_stacked.py b/examples/pylab_examples/bar_stacked.py index 67ef657a8eea..ee2473b90ac0 100644 --- a/examples/pylab_examples/bar_stacked.py +++ b/examples/pylab_examples/bar_stacked.py @@ -1,3 +1,12 @@ +""" +================= +Stacked Bar Graph +================= + +This is an example of creating a stacked bar plot with error bars using `plt.bar`. +Note the parameters `yerr` used for error bars, and `bottom` to stack the women's bars on top of the men's bars. +""" + # a stacked bar plot with errorbars import numpy as np import matplotlib.pyplot as plt diff --git a/examples/pylab_examples/dolphin.py b/examples/pylab_examples/dolphin.py index 3e876180589f..25f1de509b7a 100644 --- a/examples/pylab_examples/dolphin.py +++ b/examples/pylab_examples/dolphin.py @@ -1,3 +1,11 @@ +""" +======= +Dophins +======= + +This example shows how to draw, and manipulate shapes given verticies and nodes using the patches, path and transforms classes. +""" + import matplotlib.cm as cm import matplotlib.pyplot as plt from matplotlib.patches import Circle, PathPatch diff --git a/examples/pylab_examples/fill_between_demo.py b/examples/pylab_examples/fill_between_demo.py index b3653e456ce5..a338b197216f 100644 --- a/examples/pylab_examples/fill_between_demo.py +++ b/examples/pylab_examples/fill_between_demo.py @@ -1,3 +1,11 @@ +""" +============================== +Filling the area between lines +============================== + +This example shows how to use fill_between() to color between lines based on user-defined logic. +""" + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/pylab_examples/geo_demo.py b/examples/pylab_examples/geo_demo.py index 9ef96b2b564c..b9df747af7cb 100644 --- a/examples/pylab_examples/geo_demo.py +++ b/examples/pylab_examples/geo_demo.py @@ -1,3 +1,12 @@ +""" +====================== +Geographic Projections +====================== + +This shows 4 possible projections using subplot. +Matplotlib also supports the Basemaps Toolkit for geographic projections. +""" + import matplotlib.pyplot as plt plt.figure() diff --git a/examples/pylab_examples/log_test.py b/examples/pylab_examples/log_test.py index 0aa2a410ee8b..7b6b4253ddcd 100644 --- a/examples/pylab_examples/log_test.py +++ b/examples/pylab_examples/log_test.py @@ -1,3 +1,11 @@ +""" +======== +Log Axis +======== + +This is an example of assigning a log-scale for the x-axis using `semilogx`. +""" + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/pylab_examples/mri_demo.py b/examples/pylab_examples/mri_demo.py index 0840e5222f46..372246068381 100644 --- a/examples/pylab_examples/mri_demo.py +++ b/examples/pylab_examples/mri_demo.py @@ -1,4 +1,11 @@ -"""Displays an MRI image.""" +""" +=== +MRI +=== + +This example illustrates how to read an image (of an MRI) into a numpy array, and display it in greyscale using `ax.imshow`. + +""" import matplotlib.pyplot as plt import matplotlib.cbook as cbook From 091647cbb38a52384d244198d8e16e9e0599c66e Mon Sep 17 00:00:00 2001 From: Leon Yin Date: Mon, 6 Mar 2017 18:49:56 -0800 Subject: [PATCH 2/5] DOC FIX reviewer's comments --- examples/axisartist/demo_axisline_style.py | 6 +++--- examples/event_handling/pipong.py | 6 ++++-- examples/event_handling/poly_editor.py | 3 +-- examples/event_handling/resample.py | 6 ++++-- examples/mplot3d/mixed_subplots.py | 6 +++--- examples/pylab_examples/bar_stacked.py | 5 +++-- examples/pylab_examples/dolphin.py | 9 +++++---- examples/pylab_examples/fill_between_demo.py | 3 ++- examples/pylab_examples/geo_demo.py | 5 ++++- examples/pylab_examples/mri_demo.py | 3 ++- 10 files changed, 31 insertions(+), 21 deletions(-) diff --git a/examples/axisartist/demo_axisline_style.py b/examples/axisartist/demo_axisline_style.py index 6c21987a8052..7823e9c52b12 100644 --- a/examples/axisartist/demo_axisline_style.py +++ b/examples/axisartist/demo_axisline_style.py @@ -1,6 +1,6 @@ """ ================ -Axis Line Styles +Axis line styles ================ This example shows some configurations for axis style. @@ -18,12 +18,12 @@ for direction in ["xzero", "yzero"]: # adds arrows at the ends of each axis ax.axis[direction].set_axisline_style("-|>") - + # adds X and Y-axis from the origin ax.axis[direction].set_visible(True) for direction in ["left", "right", "bottom", "top"]: - # hides boarders + # hides borders ax.axis[direction].set_visible(False) x = np.linspace(-0.5, 1., 100) diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index 06307d57561c..8f0318adb3a1 100644 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -1,9 +1,11 @@ """ ==== -PONG +Pong ==== -A matplotlib based game of Pong illustrating one way to write interactive animation which are easily ported to multiple backends pipong.py was written by Paul Ivanov +A Matplotlib based game of Pong illustrating one way to write interactive +animations which are easily ported to multiple backends pipong.py was written +by Paul Ivanov. """ from __future__ import print_function diff --git a/examples/event_handling/poly_editor.py b/examples/event_handling/poly_editor.py index 09e9ee2fc451..86397626b037 100644 --- a/examples/event_handling/poly_editor.py +++ b/examples/event_handling/poly_editor.py @@ -4,8 +4,7 @@ ========== This is an example to show how to build cross-GUI applications using -matplotlib event handling to interact with objects on the canvas - +matplotlib event handling to interact with objects on the canvas. """ import numpy as np from matplotlib.lines import Line2D diff --git a/examples/event_handling/resample.py b/examples/event_handling/resample.py index d1b1654f1b30..cd6b62505b7f 100644 --- a/examples/event_handling/resample.py +++ b/examples/event_handling/resample.py @@ -3,7 +3,9 @@ Resampling Data =============== -Downsampling lowers the sample rate or sample size of a signal. In this tutorial, the signal is downsampled when the plot is adjusted through dragging and zooming. +Downsampling lowers the sample rate or sample size of a signal. In this +tutorial, the signal is downsampled when the plot is adjusted through dragging +and zooming. """ import numpy as np @@ -14,7 +16,7 @@ class DataDisplayDownsampler(object): def __init__(self, xdata, ydata): self.origYData = ydata self.origXData = xdata - self.ratio = 50 + self.ratio = 5 self.delta = xdata[-1] - xdata[0] def downsample(self, xstart, xend): diff --git a/examples/mplot3d/mixed_subplots.py b/examples/mplot3d/mixed_subplots.py index 5e840d67df71..16f1d5ccc29b 100644 --- a/examples/mplot3d/mixed_subplots.py +++ b/examples/mplot3d/mixed_subplots.py @@ -1,7 +1,7 @@ """ -================== -2D and 3D subplots -================== +============================================ +Demonstrate the mixing of 2D and 3D subplots +============================================ This example shows a how to plot a 2D and 3D plot on the same figure. """ diff --git a/examples/pylab_examples/bar_stacked.py b/examples/pylab_examples/bar_stacked.py index ee2473b90ac0..9bf90cce8c08 100644 --- a/examples/pylab_examples/bar_stacked.py +++ b/examples/pylab_examples/bar_stacked.py @@ -3,8 +3,9 @@ Stacked Bar Graph ================= -This is an example of creating a stacked bar plot with error bars using `plt.bar`. -Note the parameters `yerr` used for error bars, and `bottom` to stack the women's bars on top of the men's bars. +This is an example of creating a stacked bar plot with error bars using +`plt.bar`. Note the parameters `yerr` used for error bars, and `bottom` +to stack the women's bars on top of the men's bars. """ # a stacked bar plot with errorbars diff --git a/examples/pylab_examples/dolphin.py b/examples/pylab_examples/dolphin.py index 25f1de509b7a..cbdc1691536f 100644 --- a/examples/pylab_examples/dolphin.py +++ b/examples/pylab_examples/dolphin.py @@ -1,9 +1,10 @@ """ -======= -Dophins -======= +======== +Dolphins +======== -This example shows how to draw, and manipulate shapes given verticies and nodes using the patches, path and transforms classes. +This example shows how to draw, and manipulate shapes given vertices and nodes +using the `patches`, `path` and `transforms` classes. """ import matplotlib.cm as cm diff --git a/examples/pylab_examples/fill_between_demo.py b/examples/pylab_examples/fill_between_demo.py index a338b197216f..2b065ed42f60 100644 --- a/examples/pylab_examples/fill_between_demo.py +++ b/examples/pylab_examples/fill_between_demo.py @@ -3,7 +3,8 @@ Filling the area between lines ============================== -This example shows how to use fill_between() to color between lines based on user-defined logic. +This example shows how to use `fill_between` to color between lines based on +user-defined logic. """ import matplotlib.pyplot as plt diff --git a/examples/pylab_examples/geo_demo.py b/examples/pylab_examples/geo_demo.py index b9df747af7cb..ebca23272d76 100644 --- a/examples/pylab_examples/geo_demo.py +++ b/examples/pylab_examples/geo_demo.py @@ -4,7 +4,10 @@ ====================== This shows 4 possible projections using subplot. -Matplotlib also supports the Basemaps Toolkit for geographic projections. +Matplotlib also supports +Basemaps Toolkit and +Cartopy +for geographic projections. """ import matplotlib.pyplot as plt diff --git a/examples/pylab_examples/mri_demo.py b/examples/pylab_examples/mri_demo.py index 372246068381..a240ab45c233 100644 --- a/examples/pylab_examples/mri_demo.py +++ b/examples/pylab_examples/mri_demo.py @@ -3,7 +3,8 @@ MRI === -This example illustrates how to read an image (of an MRI) into a numpy array, and display it in greyscale using `ax.imshow`. +This example illustrates how to read an image (of an MRI) into a NumPy array, +and display it in greyscale using `imshow`. """ From 6c02b91c01707a3cd0fcab877f795226d8f91d38 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 10 Mar 2017 15:01:19 -0800 Subject: [PATCH 3/5] FIX blank space issue for pep8 --- examples/event_handling/resample.py | 1 + examples/pylab_examples/geo_demo.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/event_handling/resample.py b/examples/event_handling/resample.py index cd6b62505b7f..84ba3ee6539b 100644 --- a/examples/event_handling/resample.py +++ b/examples/event_handling/resample.py @@ -11,6 +11,7 @@ import numpy as np import matplotlib.pyplot as plt + # A class that will downsample the data and recompute when zoomed. class DataDisplayDownsampler(object): def __init__(self, xdata, ydata): diff --git a/examples/pylab_examples/geo_demo.py b/examples/pylab_examples/geo_demo.py index ebca23272d76..21859314ddae 100644 --- a/examples/pylab_examples/geo_demo.py +++ b/examples/pylab_examples/geo_demo.py @@ -6,7 +6,7 @@ This shows 4 possible projections using subplot. Matplotlib also supports Basemaps Toolkit and -Cartopy +Cartopy for geographic projections. """ From 1ed426a672b48fca3be1b86903f86c8492c20ec0 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Sat, 11 Mar 2017 17:14:45 -0800 Subject: [PATCH 4/5] DOC fixed title of poly_editor example --- examples/event_handling/poly_editor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/event_handling/poly_editor.py b/examples/event_handling/poly_editor.py index 86397626b037..045d85aa517d 100644 --- a/examples/event_handling/poly_editor.py +++ b/examples/event_handling/poly_editor.py @@ -1,7 +1,7 @@ """ =========== Poly Editor -========== +=========== This is an example to show how to build cross-GUI applications using matplotlib event handling to interact with objects on the canvas. From 3a504bb47346cfe0e4c5e252a5aab4c091b68c11 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 12 Apr 2017 12:31:21 +0100 Subject: [PATCH 5/5] Minor fixes --- examples/event_handling/pipong.py | 4 ++-- examples/pylab_examples/bar_stacked.py | 2 +- examples/pylab_examples/dolphin.py | 2 +- examples/pylab_examples/geo_demo.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index 8f0318adb3a1..180889a57021 100644 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -4,8 +4,8 @@ ==== A Matplotlib based game of Pong illustrating one way to write interactive -animations which are easily ported to multiple backends pipong.py was written -by Paul Ivanov. +animations which are easily ported to multiple backends. pipong.py was written +by `Paul Ivanov `_. """ from __future__ import print_function diff --git a/examples/pylab_examples/bar_stacked.py b/examples/pylab_examples/bar_stacked.py index 9bf90cce8c08..b1fb908b5604 100644 --- a/examples/pylab_examples/bar_stacked.py +++ b/examples/pylab_examples/bar_stacked.py @@ -4,7 +4,7 @@ ================= This is an example of creating a stacked bar plot with error bars using -`plt.bar`. Note the parameters `yerr` used for error bars, and `bottom` +plt.bar. Note the parameters *yerr* used for error bars, and *bottom* to stack the women's bars on top of the men's bars. """ diff --git a/examples/pylab_examples/dolphin.py b/examples/pylab_examples/dolphin.py index cbdc1691536f..7f8472a44fa1 100644 --- a/examples/pylab_examples/dolphin.py +++ b/examples/pylab_examples/dolphin.py @@ -4,7 +4,7 @@ ======== This example shows how to draw, and manipulate shapes given vertices and nodes -using the `patches`, `path` and `transforms` classes. +using the `Patches`, `Path` and `Transforms` classes. """ import matplotlib.cm as cm diff --git a/examples/pylab_examples/geo_demo.py b/examples/pylab_examples/geo_demo.py index 21859314ddae..07fcc4c43096 100644 --- a/examples/pylab_examples/geo_demo.py +++ b/examples/pylab_examples/geo_demo.py @@ -5,8 +5,8 @@ This shows 4 possible projections using subplot. Matplotlib also supports -Basemaps Toolkit and -Cartopy +`Basemaps Toolkit pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy