From 38873bbcf99f500c2afdc9a0f3a4c0136f2674e0 Mon Sep 17 00:00:00 2001 From: Salil Vanvari Date: Mon, 7 Nov 2016 18:47:20 -0800 Subject: [PATCH 1/6] Fixed extra line --- doc/users/mathtext.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/users/mathtext.rst b/doc/users/mathtext.rst index cf906d2caaff..0e1444f9c868 100644 --- a/doc/users/mathtext.rst +++ b/doc/users/mathtext.rst @@ -214,12 +214,8 @@ When using the `STIX `_ fonts, you also have the choi ``\mathfrak{Fraktur}`` :math-stix:`\mathfrak{Fraktur}` ``\mathsf{sansserif}`` :math-stix:`\mathsf{sansserif}` ``\mathrm{\mathsf{sansserif}}`` :math-stix:`\mathrm{\mathsf{sansserif}}` - ====================================== ========================================= - -.. htmlonly:: - - ====================================== ========================================= ``\mathcircled{circled}`` :math-stix:`\mathcircled{circled}` + ====================================== ========================================= There are also three global "font sets" to choose from, which are From 7517d0013518280bf750181143631fe2371627bb Mon Sep 17 00:00:00 2001 From: Salil Vanvari Date: Mon, 7 Nov 2016 18:49:16 -0800 Subject: [PATCH 2/6] Converted documentation to numpy documentation for xlim,ylim and associated functions --- lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/axes/_base.py | 86 +++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ae08af92fcdf..3f5b0c294c36 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3801,7 +3801,7 @@ def dopatch(xs, ys, **kwargs): def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, - **kwargs): + **kx`wargs): """ Make a scatter plot of `x` vs `y` diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 61efde46ca93..2dd1745c25a6 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2923,12 +2923,12 @@ def set_xscale(self, value, **kwargs): """ Set the x-axis scale - Set the scaling of the x-axis: %(scale)s - - ACCEPTS: [%(scale)s] + Parameters + ---------- + value: float + Value to scale x-axis by - Different kwargs are accepted, depending on the scale: - %(scale_docs)s + Different kwargs are accepted, depending on the scale """ # If the scale is being set to log, clip nonposx to prevent headaches # around zero @@ -3001,15 +3001,21 @@ def get_xticklabels(self, minor=False, which=None): @docstring.dedent_interpd def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ - Set the xtick labels with list of strings *labels* + Set the xtick labels with list of strings labels - Return a list of axis text instances. + Parameters + ---------- + labels: list of str + list of string labels - *kwargs* set the :class:`~matplotlib.text.Text` properties. - Valid properties are - %(Text)s + Returns + ------- + list of str + A list of axis text instances - ACCEPTS: sequence of strings + Other Parameters + ----------------- + kwargs : :class:`~matplotlib.text.Text` properties. """ if fontdict is not None: kwargs.update(fontdict) @@ -3139,7 +3145,6 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw): 0 m, is at the top. >>> set_ylim(5000, 0) - """ if 'ymin' in kw: bottom = kw.pop('ymin') @@ -3201,14 +3206,18 @@ def get_yscale(self): @docstring.dedent_interpd def set_yscale(self, value, **kwargs): - """Set the y-axis scale + """ + Set the y-axis scale - Set the scaling of the y-axis: %(scale)s + Parameters + ---------- + value: float + Value to scale y-axis by - ACCEPTS: [%(scale)s] + Other Parameters + ----------------- + kwargs : :class:`~matplotlib.text.Text` properties. - Different kwargs are accepted, depending on the scale: - %(scale_docs)s """ # If the scale is being set to log, clip nonposy to prevent headaches # around zero @@ -3284,15 +3293,22 @@ def get_yticklabels(self, minor=False, which=None): @docstring.dedent_interpd def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ - Set the y tick labels with list of strings *labels* + Set the xtick labels with list of strings labels + + Parameters + ---------- + labels: list of str + list of string labels - Return a list of :class:`~matplotlib.text.Text` instances. + Returns + ------- + list of str + A list of :class:`~matplotlib.text.Text` instances. - *kwargs* set :class:`~matplotlib.text.Text` properties for the labels. - Valid properties are - %(Text)s + Other Parameters + ---------------- + *kwargs* set the :class:`~matplotlib.text.Text` properties. - ACCEPTS: sequence of strings """ if fontdict is not None: kwargs.update(fontdict) @@ -3872,15 +3888,19 @@ def twinx(self): """ Create a twin Axes sharing the xaxis - create a twin of Axes for generating a plot with a sharex + Create a twin of Axes for generating a plot with a sharex x-axis but independent y axis. The y-axis of self will have ticks on left and the returned axes will have ticks on the right. To ensure tick marks of both axis align, see :class:`~matplotlib.ticker.LinearLocator` - .. note:: - For those who are 'picking' artists while using twinx, pick - events are only called for the artists in the top-most axes. + Returns + ------- + Axis + The newly created axis + + For those who are 'picking' artists while using twinx, pick + events are only called for the artists in the top-most axes. """ ax2 = self._make_twin_axes(sharex=self) ax2.yaxis.tick_right() @@ -3895,14 +3915,18 @@ def twiny(self): """ Create a twin Axes sharing the yaxis - create a twin of Axes for generating a plot with a shared + Create a twin of Axes for generating a plot with a shared y-axis but independent x axis. The x-axis of self will have ticks on bottom and the returned axes will have ticks on the top. - .. note:: - For those who are 'picking' artists while using twiny, pick - events are only called for the artists in the top-most axes. + Returns + ------- + Axis + The newly created axis + + For those who are 'picking' artists while using twiny, pick + events are only called for the artists in the top-most axes. """ ax2 = self._make_twin_axes(sharey=self) From a4811430b32c82b4885d765689994a35ed73d24f Mon Sep 17 00:00:00 2001 From: Salil Vanvari Date: Sun, 13 Nov 2016 14:00:19 -0800 Subject: [PATCH 3/6] Squashed commit and removed the excess changes that should not have been made in the first place --- doc/users/mathtext.rst | 5 +++++ lib/matplotlib/axes/_axes.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/users/mathtext.rst b/doc/users/mathtext.rst index 0e1444f9c868..9102ab1fde6c 100644 --- a/doc/users/mathtext.rst +++ b/doc/users/mathtext.rst @@ -214,6 +214,11 @@ When using the `STIX `_ fonts, you also have the choi ``\mathfrak{Fraktur}`` :math-stix:`\mathfrak{Fraktur}` ``\mathsf{sansserif}`` :math-stix:`\mathsf{sansserif}` ``\mathrm{\mathsf{sansserif}}`` :math-stix:`\mathrm{\mathsf{sansserif}}` + ====================================== ========================================= + + .. htmlonly:: + + ====================================== ========================================= ``\mathcircled{circled}`` :math-stix:`\mathcircled{circled}` ====================================== ========================================= diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3f5b0c294c36..ae08af92fcdf 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3801,7 +3801,7 @@ def dopatch(xs, ys, **kwargs): def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, - **kx`wargs): + **kwargs): """ Make a scatter plot of `x` vs `y` From 3e47ee04e408f082d845f1d13663a3667f3722c4 Mon Sep 17 00:00:00 2001 From: Salil Vanvari Date: Mon, 14 Nov 2016 23:54:41 -0800 Subject: [PATCH 4/6] Examples have been made python3 compliant --- examples/misc/multiprocess.py | 5 +---- examples/pylab_examples/griddata_demo.py | 4 +++- examples/widgets/lasso_selector_demo.py | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/misc/multiprocess.py b/examples/misc/multiprocess.py index b1230d464eef..92079a81fc5c 100644 --- a/examples/misc/multiprocess.py +++ b/examples/misc/multiprocess.py @@ -2,6 +2,7 @@ # Demo of using multiprocessing for generating data in one process and plotting # in another. # Written by Robert Cimrman +from six.moves import input from __future__ import print_function import time @@ -76,10 +77,6 @@ def main(): for ii in range(10): pl.plot() time.sleep(0.5) - try: - input = raw_input - except NameError: - pass input('press Enter...') pl.plot(finished=True) diff --git a/examples/pylab_examples/griddata_demo.py b/examples/pylab_examples/griddata_demo.py index 74af8424fb83..07cde8561628 100644 --- a/examples/pylab_examples/griddata_demo.py +++ b/examples/pylab_examples/griddata_demo.py @@ -2,8 +2,10 @@ from matplotlib.mlab import griddata import matplotlib.pyplot as plt import numpy as np +from six.moves import input + # make up data. -#npts = int(raw_input('enter # of random points to plot:')) +#npts = int(input('enter # of random points to plot:')) seed(0) npts = 200 x = uniform(-2, 2, npts) diff --git a/examples/widgets/lasso_selector_demo.py b/examples/widgets/lasso_selector_demo.py index a8b2bdb446bd..0eb1cb998e01 100644 --- a/examples/widgets/lasso_selector_demo.py +++ b/examples/widgets/lasso_selector_demo.py @@ -8,6 +8,13 @@ from matplotlib.path import Path +try: + raw_input +except NameError: + # Python 3 + raw_input = input + + class SelectFromCollection(object): """Select indices from a matplotlib collection using `LassoSelector`. From 5b705a041b94d5536613999dfeaa33a6fd767865 Mon Sep 17 00:00:00 2001 From: Salil Vanvari Date: Tue, 15 Nov 2016 11:17:52 -0800 Subject: [PATCH 5/6] FIX Removed random extra white space and other nitpicks --- doc/users/mathtext.rst | 7 +-- examples/misc/multiprocess.py | 3 +- examples/pylab_examples/griddata_demo.py | 10 ++-- examples/widgets/lasso_selector_demo.py | 7 --- lib/matplotlib/axes/_base.py | 72 +++++++++++++++--------- 5 files changed, 55 insertions(+), 44 deletions(-) diff --git a/doc/users/mathtext.rst b/doc/users/mathtext.rst index 9102ab1fde6c..a0e1b8ddd6a4 100644 --- a/doc/users/mathtext.rst +++ b/doc/users/mathtext.rst @@ -214,13 +214,12 @@ When using the `STIX `_ fonts, you also have the choi ``\mathfrak{Fraktur}`` :math-stix:`\mathfrak{Fraktur}` ``\mathsf{sansserif}`` :math-stix:`\mathsf{sansserif}` ``\mathrm{\mathsf{sansserif}}`` :math-stix:`\mathrm{\mathsf{sansserif}}` - ====================================== ========================================= + ====================================== ========================================= - .. htmlonly:: + .. htmlonly:: - ====================================== ========================================= + ====================================== ========================================= ``\mathcircled{circled}`` :math-stix:`\mathcircled{circled}` - ====================================== ========================================= There are also three global "font sets" to choose from, which are diff --git a/examples/misc/multiprocess.py b/examples/misc/multiprocess.py index 92079a81fc5c..7d2ca7ad4930 100644 --- a/examples/misc/multiprocess.py +++ b/examples/misc/multiprocess.py @@ -2,9 +2,10 @@ # Demo of using multiprocessing for generating data in one process and plotting # in another. # Written by Robert Cimrman -from six.moves import input from __future__ import print_function +from six.moves import input + import time from multiprocessing import Process, Pipe import numpy as np diff --git a/examples/pylab_examples/griddata_demo.py b/examples/pylab_examples/griddata_demo.py index 07cde8561628..cb929f6fdb6f 100644 --- a/examples/pylab_examples/griddata_demo.py +++ b/examples/pylab_examples/griddata_demo.py @@ -1,15 +1,13 @@ -from numpy.random import uniform, seed from matplotlib.mlab import griddata import matplotlib.pyplot as plt import numpy as np -from six.moves import input # make up data. -#npts = int(input('enter # of random points to plot:')) -seed(0) +random_state = np.random.RandomState(19680801) + npts = 200 -x = uniform(-2, 2, npts) -y = uniform(-2, 2, npts) +x = random_state.uniform(-2, 2, npts) +y = random_state.uniform(-2, 2, npts) z = x*np.exp(-x**2 - y**2) # define grid. xi = np.linspace(-2.1, 2.1, 100) diff --git a/examples/widgets/lasso_selector_demo.py b/examples/widgets/lasso_selector_demo.py index 0eb1cb998e01..a8b2bdb446bd 100644 --- a/examples/widgets/lasso_selector_demo.py +++ b/examples/widgets/lasso_selector_demo.py @@ -8,13 +8,6 @@ from matplotlib.path import Path -try: - raw_input -except NameError: - # Python 3 - raw_input = input - - class SelectFromCollection(object): """Select indices from a matplotlib collection using `LassoSelector`. diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 2dd1745c25a6..65ebef8304bf 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2918,17 +2918,29 @@ def get_xscale(self): get_xscale.__doc__ = "Return the xaxis scale string: %s""" % ( ", ".join(mscale.get_scale_names())) - @docstring.dedent_interpd def set_xscale(self, value, **kwargs): """ Set the x-axis scale Parameters ---------- - value: float - Value to scale x-axis by + value : ["linear", "log", "symlog", "logit"] + scaling strategy to apply + + Notes + ----- + Different kwargs are accepted, depending on the scale. See + the `~matplotlib.scale` module for more information. + + See also + -------- + matplotlib.scale.LinearScale : linear transfrom + + matplotlib.scale.LogTransform : log transform - Different kwargs are accepted, depending on the scale + matplotlib.scale.SymmetricalLogTransform : symlog transform + + matplotlib.scale.LogisticTransform : logit transform """ # If the scale is being set to log, clip nonposx to prevent headaches # around zero @@ -2998,24 +3010,22 @@ def get_xticklabels(self, minor=False, which=None): self.xaxis.get_ticklabels(minor=minor, which=which)) - @docstring.dedent_interpd def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ - Set the xtick labels with list of strings labels + Set the xtick labels with list of string labels Parameters ---------- - labels: list of str + labels : list of str list of string labels Returns ------- - list of str - A list of axis text instances + A list of `~matplotlib.text.Text` instances Other Parameters ----------------- - kwargs : :class:`~matplotlib.text.Text` properties. + **kwargs : `~matplotlib.text.Text` properties. """ if fontdict is not None: kwargs.update(fontdict) @@ -3204,20 +3214,29 @@ def get_yscale(self): get_yscale.__doc__ = "Return the yaxis scale string: %s""" % ( ", ".join(mscale.get_scale_names())) - @docstring.dedent_interpd def set_yscale(self, value, **kwargs): """ Set the y-axis scale Parameters ---------- - value: float - Value to scale y-axis by + value : ["linear", "log", "symlog", "logit"] + scaling strategy to apply - Other Parameters - ----------------- - kwargs : :class:`~matplotlib.text.Text` properties. + Notes + ----- + Different kwargs are accepted, depending on the scale. See + the `~matplotlib.scale` module for more information. + + See also + -------- + matplotlib.scale.LinearScale : linear transfrom + + matplotlib.scale.LogTransform : log transform + + matplotlib.scale.SymmetricalLogTransform : symlog transform + matplotlib.scale.LogisticTransform : logit transform """ # If the scale is being set to log, clip nonposy to prevent headaches # around zero @@ -3290,25 +3309,22 @@ def get_yticklabels(self, minor=False, which=None): self.yaxis.get_ticklabels(minor=minor, which=which)) - @docstring.dedent_interpd def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ Set the xtick labels with list of strings labels Parameters ---------- - labels: list of str + labels : list of str list of string labels Returns ------- - list of str - A list of :class:`~matplotlib.text.Text` instances. + A list of `~matplotlib.text.Text` instances. Other Parameters ---------------- - *kwargs* set the :class:`~matplotlib.text.Text` properties. - + **kwargs : `~matplotlib.text.Text` properties. """ if fontdict is not None: kwargs.update(fontdict) @@ -3888,17 +3904,19 @@ def twinx(self): """ Create a twin Axes sharing the xaxis - Create a twin of Axes for generating a plot with a sharex - x-axis but independent y axis. The y-axis of self will have + Create a twin of Axes for generating a plot with a shared + x-axis but independent y-axis. The y-axis of self will have ticks on left and the returned axes will have ticks on the right. To ensure tick marks of both axis align, see - :class:`~matplotlib.ticker.LinearLocator` + `~matplotlib.ticker.LinearLocator` Returns ------- Axis The newly created axis + Notes + ----- For those who are 'picking' artists while using twinx, pick events are only called for the artists in the top-most axes. """ @@ -3916,7 +3934,7 @@ def twiny(self): Create a twin Axes sharing the yaxis Create a twin of Axes for generating a plot with a shared - y-axis but independent x axis. The x-axis of self will have + y-axis but independent x-axis. The x-axis of self will have ticks on bottom and the returned axes will have ticks on the top. @@ -3925,6 +3943,8 @@ def twiny(self): Axis The newly created axis + Notes + ------ For those who are 'picking' artists while using twiny, pick events are only called for the artists in the top-most axes. """ From 58f116940b8ac24bbe6a2657599927a5f83dd9c3 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 13 Jan 2017 15:33:38 -0800 Subject: [PATCH 6/6] FIX nitpicks --- lib/matplotlib/axes/_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 65ebef8304bf..94b3f3b255b8 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2924,7 +2924,7 @@ def set_xscale(self, value, **kwargs): Parameters ---------- - value : ["linear", "log", "symlog", "logit"] + value : {"linear", "log", "symlog", "logit"} scaling strategy to apply Notes @@ -3220,7 +3220,7 @@ def set_yscale(self, value, **kwargs): Parameters ---------- - value : ["linear", "log", "symlog", "logit"] + value : {"linear", "log", "symlog", "logit"} scaling strategy to apply Notes @@ -3311,7 +3311,7 @@ def get_yticklabels(self, minor=False, which=None): def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): """ - Set the xtick labels with list of strings labels + Set the y-tick labels with list of strings labels Parameters ----------