2424 _barh_wrapper ,
2525 _boxplot_wrapper ,
2626 _cmap_changer ,
27+ _concatenate_docstrings ,
2728 _cycle_changer ,
2829 _fill_between_wrapper ,
2930 _fill_betweenx_wrapper ,
3233 _hlines_wrapper ,
3334 _indicate_error ,
3435 _parametric_wrapper ,
35- _plot_wrapper ,
3636 _scatter_wrapper ,
3737 _standardize_1d ,
3838 _standardize_2d ,
@@ -1657,14 +1657,6 @@ def parametric(
16571657 values : list of float
16581658 The parametric values used to map points on the line to colors
16591659 in the colormap. This can also be passed as a third positional argument.
1660- cmap : colormap spec, optional
1661- The colormap specifier, passed to `~proplot.constructor.Colormap`.
1662- cmap_kw : dict, optional
1663- Keyword arguments passed to `~proplot.constructor.Colormap`.
1664- norm : normalizer spec, optional
1665- The normalizer, passed to `~proplot.constructor.Norm`.
1666- norm_kw : dict, optional
1667- Keyword arguments passed to `~proplot.constructor.Norm`.
16681660 interp : int, optional
16691661 If greater than ``0``, we interpolate to additional points
16701662 between the `values` coordinates. The number corresponds to the
@@ -1673,6 +1665,9 @@ def parametric(
16731665 scalex, scaley : bool, optional
16741666 Whether the view limits are adapted to the data limits. The values are
16751667 passed on to `~matplotlib.axes.Axes.autoscale_view`.
1668+ %(standardize_1d_kwargs)s
1669+ %(cycle_changer_kwargs)s
1670+ %(add_errorbars_kwargs)s
16761671
16771672 Other parameters
16781673 ----------------
@@ -1687,7 +1682,7 @@ def parametric(
16871682 """
16881683 # Get x/y coordinates and values for points to the 'left' and 'right'
16891684 # of each joint
1690- x , y = args # standardized by parametric wrapper
1685+ x , y = _standardize_1d ( args )
16911686 interp # avoid U100 unused argument error (arg is handled by wrapper)
16921687 coords = []
16931688 levels = edges (values )
@@ -1731,6 +1726,167 @@ def parametric(
17311726 hs .levels = levels # needed for other functions
17321727 return hs
17331728
1729+ @_concatenate_docstrings
1730+ @docstring .add_snippets
1731+ def plot (self , * args , cmap = None , values = None , ** kwargs ):
1732+ """
1733+ Parameters
1734+ ----------
1735+ %(standardize_1d_args)s
1736+ cmap, values : optional
1737+ *Deprecated usage*. Passed to `~proplot.axes.Axes.cmapline`.
1738+ %(standardize_1d_kwargs)s
1739+ %(cycle_changer_kwargs)s
1740+ %(add_errorbars_kwargs)s
1741+
1742+ Other parameters
1743+ ----------------
1744+ **kwargs
1745+ `~matplotlib.lines.Line2D` properties.
1746+ """
1747+ if len (args ) > 3 : # e.g. with fmt string
1748+ raise ValueError (f'Expected 1-3 positional args, got { len (args )} .' )
1749+ if cmap is not None :
1750+ warnings ._warn_proplot (
1751+ 'Drawing "parametric" plots with ax.plot(x, y, values=values, cmap=cmap) '
1752+ 'is deprecated and will be removed in a future version. Please use '
1753+ 'ax.parametric(x, y, values, cmap=cmap) instead.'
1754+ )
1755+ return self .parametric (* args , cmap = cmap , values = values , ** kwargs )
1756+
1757+ # Draw lines
1758+ result = super ().plot (* args , values = values , ** kwargs )
1759+
1760+ # Add sticky edges? No because there is no way to check whether "dependent variable"
1761+ # is x or y axis like with area/areax and bar/barh. Better to always have margin.
1762+ # for objs in result:
1763+ # if not isinstance(objs, tuple):
1764+ # objs = (objs,)
1765+ # for obj in objs:
1766+ # xdata = obj.get_xdata()
1767+ # obj.sticky_edges.x.extend((np.min(xdata), np.max(xdata)))
1768+
1769+ return result
1770+
1771+ @_concatenate_docstrings
1772+ @docstring .add_snippets
1773+ def scatter_wrapper (
1774+ self , * args ,
1775+ s = None , size = None , markersize = None ,
1776+ c = None , color = None , markercolor = None , smin = None , smax = None ,
1777+ cmap = None , cmap_kw = None , norm = None , norm_kw = None ,
1778+ vmin = None , vmax = None , N = None , levels = None , values = None ,
1779+ symmetric = False , locator = None , locator_kw = None ,
1780+ lw = None , linewidth = None , linewidths = None ,
1781+ markeredgewidth = None , markeredgewidths = None ,
1782+ edgecolor = None , edgecolors = None ,
1783+ markeredgecolor = None , markeredgecolors = None ,
1784+ ** kwargs
1785+ ):
1786+ """
1787+ Parameters
1788+ ----------
1789+ %(standardize_1d_args)s
1790+ s, size, markersize : float or list of float, optional
1791+ The marker size(s). The units are scaled by `smin` and `smax`.
1792+ smin, smax : float, optional
1793+ The minimum and maximum marker size in units points ** 2 used to
1794+ scale the `s` array. If not provided, the marker sizes are equivalent
1795+ to the values in the `s` array.
1796+ c, color, markercolor : color-spec or list thereof, or array, optional
1797+ The marker fill color(s). If this is an array of scalar values, the
1798+ colors will be generated by passing the values through the `norm`
1799+ normalizer and drawing from the `cmap` colormap.
1800+ %(axes.cmap_changer)s
1801+ lw, linewidth, linewidths, markeredgewidth, markeredgewidths : \
1802+ float or list thereof, optional
1803+ The marker edge width.
1804+ edgecolors, markeredgecolor, markeredgecolors : \
1805+ color-spec or list thereof, optional
1806+ The marker edge color.
1807+ %(standardize_1d_kwargs)s
1808+ %(cycle_changer_kwargs)s
1809+ %(add_errorbars_kwargs)s
1810+
1811+ Other parameters
1812+ ----------------
1813+ **kwargs
1814+ Passed to `~matplotlib.axes.Axes.scatter`.
1815+ """
1816+ # Manage input arguments
1817+ # NOTE: Parse 1d must come before this
1818+ nargs = len (args )
1819+ if len (args ) > 4 :
1820+ raise ValueError (f'Expected 1-4 positional args, got { nargs } .' )
1821+ args = list (args )
1822+ if len (args ) == 4 :
1823+ c = args .pop (1 )
1824+ if len (args ) == 3 :
1825+ s = args .pop (0 )
1826+
1827+ # Apply some aliases for keyword arguments
1828+ c = _not_none (c = c , color = color , markercolor = markercolor )
1829+ s = _not_none (s = s , size = size , markersize = markersize )
1830+ lw = _not_none (
1831+ lw = lw , linewidth = linewidth , linewidths = linewidths ,
1832+ markeredgewidth = markeredgewidth , markeredgewidths = markeredgewidths ,
1833+ )
1834+ ec = _not_none (
1835+ edgecolor = edgecolor , edgecolors = edgecolors ,
1836+ markeredgecolor = markeredgecolor , markeredgecolors = markeredgecolors ,
1837+ )
1838+
1839+ # Get colormap
1840+ cmap_kw = cmap_kw or {}
1841+ if cmap is not None :
1842+ cmap = constructor .Colormap (cmap , ** cmap_kw )
1843+
1844+ # Get normalizer and levels
1845+ # NOTE: If the length of the c array !=
1846+ ticks = None
1847+ carray = np .atleast_1d (c )
1848+ if (
1849+ np .issubdtype (carray .dtype , np .number )
1850+ and not (carray .ndim == 2 and carray .shape [1 ] in (3 , 4 ))
1851+ ):
1852+ carray = carray .ravel ()
1853+ norm , cmap , _ , ticks = _build_discrete_norm (
1854+ carray , # sample data for getting suitable levels
1855+ N = N , levels = levels , values = values ,
1856+ norm = norm , norm_kw = norm_kw ,
1857+ locator = locator , locator_kw = locator_kw ,
1858+ cmap = cmap , vmin = vmin , vmax = vmax , extend = 'neither' ,
1859+ symmetric = symmetric ,
1860+ )
1861+
1862+ # Fix 2D arguments but still support scatter(x_vector, y_2d) usage
1863+ # NOTE: Since we are flattening vectors the coordinate metadata is meaningless,
1864+ # so converting to ndarray and stripping metadata is no problem.
1865+ # NOTE: numpy.ravel() preserves masked arrays
1866+ if len (args ) == 2 and all (np .asarray (arg ).squeeze ().ndim > 1 for arg in args ):
1867+ args = tuple (np .ravel (arg ) for arg in args )
1868+
1869+ # Scale s array
1870+ if np .iterable (s ) and (smin is not None or smax is not None ):
1871+ smin_true , smax_true = min (s ), max (s )
1872+ if smin is None :
1873+ smin = smin_true
1874+ if smax is None :
1875+ smax = smax_true
1876+ s = (
1877+ smin + (smax - smin )
1878+ * (np .array (s ) - smin_true ) / (smax_true - smin_true )
1879+ )
1880+ obj = super ().scatter (
1881+ * args , c = c , s = s , cmap = cmap , norm = norm ,
1882+ linewidths = lw , edgecolors = ec , ** kwargs
1883+ )
1884+ if ticks is not None :
1885+ obj .ticks = ticks
1886+ return obj
1887+
1888+
1889+
17341890 def violins (self , * args , ** kwargs ):
17351891 """
17361892 Alias for `~matplotlib.axes.Axes.violinplot`.
0 commit comments