Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bioneuron_oracle/tests/test_feedforward.py:60: in feedforward
- plt.subplots(3, 1, 1)
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- nrows = 3, ncols = 1, sharex = 1, sharey = 'none', squeeze = True
- subplot_kw = None, gridspec_kw = None, fig_kw = {}
- share_values = ['all', 'row', 'col', 'none']
- def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
- subplot_kw=None, gridspec_kw=None, **fig_kw):
- """
- Create a figure and a set of subplots
- This utility wrapper makes it convenient to create common layouts of
- subplots, including the enclosing figure object, in a single call.
- Parameters
- ----------
- nrows, ncols : int, optional, default: 1
- Number of rows/columns of the subplot grid.
- sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
- Controls sharing of properties among x (`sharex`) or y (`sharey`)
- axes:
- - True or 'all': x- or y-axis will be shared among all
- subplots.
- - False or 'none': each subplot x- or y-axis will be
- independent.
- - 'row': each subplot row will share an x- or y-axis.
- - 'col': each subplot column will share an x- or y-axis.
- When subplots have a shared x-axis along a column, only the x tick
- labels of the bottom subplot are visible. Similarly, when subplots
- have a shared y-axis along a row, only the y tick labels of the first
- column subplot are visible.
- squeeze : bool, optional, default: True
- - If True, extra dimensions are squeezed out from the returned Axes
- object:
- - if only one subplot is constructed (nrows=ncols=1), the
- resulting single Axes object is returned as a scalar.
- - for Nx1 or 1xN subplots, the returned object is a 1D numpy
- object array of Axes objects are returned as numpy 1D arrays.
- - for NxM, subplots with N>1 and M>1 are returned as a 2D arrays.
- - If False, no squeezing at all is done: the returned Axes object is
- always a 2D array containing Axes instances, even if it ends up
- being 1x1.
- subplot_kw : dict, optional
- Dict with keywords passed to the
- :meth:`~matplotlib.figure.Figure.add_subplot` call used to create each
- subplot.
- gridspec_kw : dict, optional
- Dict with keywords passed to the
- :class:`~matplotlib.gridspec.GridSpec` constructor used to create the
- grid the subplots are placed on.
- fig_kw : dict, optional
- Dict with keywords passed to the :func:`figure` call. Note that all
- keywords not recognized above will be automatically included here.
- Returns
- -------
- fig : :class:`matplotlib.figure.Figure` object
- ax : Axes object or array of Axes objects.
- ax can be either a single :class:`matplotlib.axes.Axes` object or an
- array of Axes objects if more than one subplot was created. The
- dimensions of the resulting array can be controlled with the squeeze
- keyword, see above.
- Examples
- --------
- First create some toy data:
- >>> x = np.linspace(0, 2*np.pi, 400)
- >>> y = np.sin(x**2)
- Creates just a figure and only one subplot
- >>> fig, ax = plt.subplots()
- >>> ax.plot(x, y)
- >>> ax.set_title('Simple plot')
- Creates two subplots and unpacks the output array immediately
- >>> f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
- >>> ax1.plot(x, y)
- >>> ax1.set_title('Sharing Y axis')
- >>> ax2.scatter(x, y)
- Creates four polar axes, and accesses them through the returned array
- >>> fig, axes = plt.subplots(2, 2, subplot_kw=dict(polar=True))
- >>> axes[0, 0].plot(x, y)
- >>> axes[1, 1].scatter(x, y)
- Share a X axis with each column of subplots
- >>> plt.subplots(2, 2, sharex='col')
- Share a Y axis with each row of subplots
- >>> plt.subplots(2, 2, sharey='row')
- Share both X and Y axes with all subplots
- >>> plt.subplots(2, 2, sharex='all', sharey='all')
- Note that this is the same as
- >>> plt.subplots(2, 2, sharex=True, sharey=True)
- See Also
- --------
- figure
- subplot
- """
- # for backwards compatibility
- if isinstance(sharex, bool):
- if sharex:
- sharex = "all"
- else:
- sharex = "none"
- if isinstance(sharey, bool):
- if sharey:
- sharey = "all"
- else:
- sharey = "none"
- share_values = ["all", "row", "col", "none"]
- if sharex not in share_values:
- # This check was added because it is very easy to type
- # `subplots(1, 2, 1)` when `subplot(1, 2, 1)` was intended.
- # In most cases, no error will ever occur, but mysterious behavior will
- # result because what was intended to be the subplot index is instead
- # treated as a bool for sharex.
- if isinstance(sharex, int):
- warnings.warn("sharex argument to subplots() was an integer."
- " Did you intend to use subplot() (without 's')?")
- raise ValueError("sharex [%s] must be one of %s" %
- > (sharex, share_values))
- E ValueError: sharex [1] must be one of [u'all', u'row', u'col', u'none']
- ../.virtualenvs/oracle/local/lib/python2.7/site-packages/matplotlib/pyplot.py:1194: ValueError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement