diff --git a/WHATSNEW.rst b/WHATSNEW.rst index 3a232accb..c290e027f 100644 --- a/WHATSNEW.rst +++ b/WHATSNEW.rst @@ -49,12 +49,12 @@ Deprecated * Rename :rcraw:`cartopy.autoextent`, :rcraw:`cartopy.circular` to :rcraw:`geo.extent`, :rcraw:`geo.round`, with :rcraw:`geo.extent` taking either of the values ``'globe'`` or ``'auto'`` (``cartopy.autoextent`` is translated when used) (:commit:`c4b93c9d`). -* Improve the `~ultraplot.gridspec.GridSpec` "panel" obfuscation by +* Improve the :class:`~ultraplot.gridspec.GridSpec` "panel" obfuscation by renaming `~ultraplot.gridspec.GridSpec.get_subplot_geometry` to `~ultraplot.gridspec.GridSpec.get_geometry`, `~ultraplot.gridspec.GridSpec.get_geometry` to `~ultraplot.gridspec.GridSpec.get_total_geometry` (:commit:`52f57094`). -* Improve the `~ultraplot.gridspec.GridSpec` "panel" obfuscation by having the public - `~ultraplot.gridspec.GridSpec` properties ``gs.nrows``, ``gs.ncols``, ``gs.wratios``, +* Improve the :class:`~ultraplot.gridspec.GridSpec` "panel" obfuscation by having the public + :class:`~ultraplot.gridspec.GridSpec` properties ``gs.nrows``, ``gs.ncols``, ``gs.wratios``, ``gs.hratios``, ``gs.wspace``, ``gs.hspace``, ``gs.wpad``, and ``gs.hpad`` refer to the reduced non-panel geometry (:commit:`52f57094`). * Deprecate `maxn` and `maxn_minor` passed to `~ultraplot.axes.Axes.colorbar` and @@ -119,7 +119,7 @@ Features * Add the `wgroup`, `hgroup`, and `group` keywords (analogous to `wequal`, etc.) to optionally disable tight layout behavior of comparing adjacent subplot "groups" rather than all subplots in the row or column (:commit:`b4bf072d`). -* Permit passing `~ultraplot.gridspec.GridSpec` instances to +* Permit passing :class:`~ultraplot.gridspec.GridSpec` instances to `~ultraplot.figure.Figure.add_subplots` to quickly draw a subplot inside each gridspec slot in row or column-major order (:commit:`a9ad7429`). * Add `~ultraplot.gridspec.GridSpec.copy` method to re-use the same gridspec geometry @@ -146,7 +146,7 @@ Features * Add the public ultraplot class `ultraplot.ticker.IndexFormatter`, since the matplotlib version was entirely removed in version 3.5 (:commit:`c2dd8b2e`). * Replace `matplotlib.ticker.IndexLocator` with `ultraplot.ticker.IndexLocator`, - consistent with `~ultraplot.ticker.IndexFormatter`, and remove the limitation + consistent with :class:`~ultraplot.ticker.IndexFormatter`, and remove the limitation requiring data to be plotted on the axis (:commit:`c2dd8b2e`). * Permit picking the `~matplotlib.ticker.NullFormatter`, `~ultraplot.ticker.AutoFormatter` `~matplotlib.ticker.NullLocator`, and `~matplotlib.ticker.AutoLocator` by passing @@ -211,7 +211,7 @@ Bug fixes with overlapping or identical subplotspecs (:commit:`87f098b6`). * Fix issue where super label settings (e.g. size) cannot be updated after they are initially created (:commit:`2cd72fd3`). -* Fix issue where `ultraplot.axes.CartesianAxes.format` keyword arguments cannot be +* Fix issue where :func:`ultraplot.axes.CartesianAxes.format` keyword arguments cannot be passed to `~ultraplot.axes.Axes.panel_axes` (:commit:`1b3d0d48`). * Fix issue where outer colorbars are drawn twice due to adding them as both figure-wide axes and child axes (:issue:`304`). @@ -226,7 +226,7 @@ Bug fixes * Fix issue where list-of-string colors passed to `~ultraplot.axes.Axes.scatter` are interpreted as data values (:issue:`316`). * Fix issue where *x* and *y* axis limits are reversed when passing to - `~ultraplot.axes.PlotAxes.hexbin` and `~ultraplot.axes.PlotAxes.hist2d` (:issue:`334`). + `~ultraplot.axes.PlotAxes.hexbin` and :func:`~ultraplot.axes.PlotAxes.hist2d` (:issue:`334`). * Fix regression where *x* or *y* axis limits are reversed when passing to `~ultraplot.axes.PlotAxes.hist` and `~ultraplot.axes.PlotAxes.histh` (:issue:`334`). * Fix issue where settings passed to `~ultraplot.axes.Axes.colorbar` after calling e.g. @@ -236,12 +236,12 @@ Bug fixes * Fix issue where background properties like `color` and `linewidth` cannot be passed to `~ultraplot.axes.Axes` instantiation commands (:commit:`b67b046c`). * Fix issue where manual data aspect ratio passed with `~ultraplot.axes.Axes.format` - or `~matplotlib.axes.Axes.set_aspect` is inverted (:commit:`7cda3b23`). + or :func:`~matplotlib.axes.Axes.set_aspect` is inverted (:commit:`7cda3b23`). * Fix issue where continuous normalizer `vmin` and `vmax` are not set to min and max of `levels` when passed to `~ultraplot.colors.DiscreteNorm` (:commit:`e9ed16c1`). * Fix issue where unevenly-spaced `levels` combined with - `~ultraplot.colors.DiscreteColormap` incorrectly samples the color list (:issue:`299`). -* Fix issue where `~ultraplot.axes.Axes.legend` ignores the user-input `fontsize` + :class:`~ultraplot.colors.DiscreteColormap` incorrectly samples the color list (:issue:`299`). +* Fix issue where :class:`~ultraplot.axes.Axes.legend` ignores the user-input `fontsize` (:issue:`331`). * Fix issue where ``ultraplotrc`` settings are ignored if a subsequent line contains an overlapping meta-setting (:issue:`333`). @@ -324,11 +324,11 @@ Features to version 7.0 (adds ``'bam'``, ``'bamO'``, ``'batlowK'``, ``'batlowW'``, ``'bukavu'``, ``'fes'``, and ``'vanimo'``) (:commit:`c172a74b`). * Add `[xy]labelsize`, `[xy]labelweight`, `[xy]ticklabelsize`, `[xy]ticklabelweight` - keywords to `ultraplot.axes.CartesianAxes.format` (:commit:`975025df`). + keywords to :func:`ultraplot.axes.CartesianAxes.format` (:commit:`975025df`). * Add `labelsize` and `labelweight` keywords to `ultraplot.axes.PolarAxes.format`, `ultraplot.axes.GeoAxes.format` (:commit:`975025df`). * Automatically set `xpineloc` and `yspineloc` to ``'bottom'`` and ``'left'`` - when `xbounds` or `ybounds` are passed to `ultraplot.axes.CartesianAxes.format` only + when `xbounds` or `ybounds` are passed to :func:`ultraplot.axes.CartesianAxes.format` only if both spines are currently visible (:commit:`a2396afe`). * Automatically use the top/right spine rather than the bottom/left spine when setting `xspineloc` or `yspineloc` to the position ``('axes', coord)`` or ``('data', coord)`` @@ -336,8 +336,8 @@ Features * Passing ``[loninline|latinline|inlinelabels]=True`` to `~ultraplot.axes.GeoAxes.format` now implies ``[lonlabels|latlabels|labels]=True`` unless specified otherwise (:commit:`ed372d64`). This fixes annoying redundancy when calling ``format``. -* Improve default `~ultraplot.colors.ContinuousColormap.reversed` and - `~ultraplot.colors.ContinuousColormap.shifted` colormap names (:commit:`a4218e09`). +* Improve default :property:`~ultraplot.colors.ContinuousColormap.reversed` and + :property:`~ultraplot.colors.ContinuousColormap.shifted` colormap names (:commit:`a4218e09`). Bug fixes --------- @@ -354,8 +354,8 @@ Bug fixes * Fix issue where `vmin` and `vmax` are ignored when making plots with discrete levels (:issue:`276`). * Fix issue where `autodiverging` is disabled even when known diverging colormaps - are passed to `~ultraplot.axes.PlotAxes` commands (:commit:`2eca2198`). -* Fix issue where colormaps made with `~ultraplot.constructor.Colormap` with unspecified + are passed to :class:`~ultraplot.axes.PlotAxes` commands (:commit:`2eca2198`). +* Fix issue where colormaps made with :class:`~ultraplot.constructor.Colormap` with unspecified `name` cannot be assigned as `~ultraplot.config.rc` defaults (:commit:`0e93b7fa`). * Fix issue where registered colormaps with trailing ``_r`` or ``_s`` cannot be retrieved due to automatic reversing/shifting feature (:commit:`345680c9`). @@ -418,7 +418,7 @@ Bug fixes * Fix fatal error instantiating `~ultraplot.axes.ThreeAxes` (:issue:`389`). * Fix issue with plotting in `~ultraplot.axes.ThreeAxes` by inheriting from from - `~ultraplot.axes.Axes` instead of `~ultraplot.axes.PlotAxes` (:commit:`64623d92`). + `~ultraplot.axes.Axes` instead of :class:`~ultraplot.axes.PlotAxes` (:commit:`64623d92`). * Fix issue where `~ultraplot.axes.CartesianAxes.format` ignores `margin` rather than using it for both `xmargin` and `ymargin` (:commit:`ba32fd1a`). * Fix issue where `color` passed to ``format`` triggers deprecation warning even @@ -451,11 +451,11 @@ Features * Permit passing `includepanels` and `mathtext_fallback` as `ultraplot.figure.Figure.format` keywords instead of just ``__init__`` keywords (:commit:`33bff576`). -* Permit passing ``loc`` `ultraplot.axes.CartesianAxes.format` keyword argument(s) to +* Permit passing ``loc`` :func:`ultraplot.axes.CartesianAxes.format` keyword argument(s) to ``alt[xy]`` (:commit:`eaab8658`). For example ``ax.alty(loc='left')`` changes the spine, tick mark, tick label, axis label, and offset label sides to the opposite of the default: *left* for the new alternate axes, *right* for the original axes. -* Improve documentation for ``loc`` `ultraplot.axes.CartesianAxes.format` keywords +* Improve documentation for ``loc`` :func:`ultraplot.axes.CartesianAxes.format` keywords (:commit:`1fa90f87`, :commit:`48dc346d`). Inheritance order is ``loc`` or ``spineloc`` --> ``tickloc`` --> ``ticklabelloc`` --> ``labelloc`` and ``offsetloc``, e.g. ``xloc='bottom'`` implies ``xtickloc='bottom'`` unless specified otherwise. @@ -464,7 +464,7 @@ Features from updated rc settings, and issue error message if ``tickloc`` or ``ticklabelloc`` are invalid (:commit:`616d81fa`, :commit:`219e4b21`, :commit:`bc5a692c`). * Add documentation for previously-hidden `xticklabelloc`, `yticklabelloc`, `xlabelloc`, - and `ylabelloc` `ultraplot.axes.CartesianAxes.format` keywords (:commit:`1fa90f87`). + and `ylabelloc` :func:`ultraplot.axes.CartesianAxes.format` keywords (:commit:`1fa90f87`). * Add `xoffsetloc`, `yoffsetloc` keywords to control position of order-of-magnitude indicator location for x and y axes (with large numbers) (:commit:`96a37e53`). * Add `xlabelcolor` and `ylabelcolor` keywords as alternatives to `xcolor` and `ycolor` @@ -482,7 +482,7 @@ Features * Ensure contour `labels` appear on top of inner titles/a-b-c labels by decreasing default `zorder` from ``cntr_zorder + 2`` to ``cntr_zorder + 1`` (:commit:`59222164`). * Implement "descending level" support directly inside `~ultraplot.colors.DiscreteNorm` - rather than cmap parser in `~ultraplot.axes.PlotAxes` commands, and auto-reverse + rather than cmap parser in :class:`~ultraplot.axes.PlotAxes` commands, and auto-reverse descending levels passed to `~ultraplot.colors.SegmentedNorm` (:commit:`46d8bedc`). * Improve ``show_cmaps`` and ``show_cycles``: Stop passing arguments through constructor functions, preserve case for user colormap labels, and avoid @@ -498,7 +498,7 @@ Bug fixes * Fix issue where default outer legend axes-relative `loc` does not take into account the underlying "panel" side (:commit:`2446acc1`). * Fix issue where axis label color is overwritten during ``__init__`` - call to `ultraplot.axes.CartesianAxes.format` (:commit:`b454a513`). + call to :func:`ultraplot.axes.CartesianAxes.format` (:commit:`b454a513`). * Fix issue where setting `xspineloc` or `yspineloc` to invalid `tickloc` (e.g., ``'zero'`` or ``'center'``) also disables the ticks (:commit:`616d81fa`). * Fix issue where setting axis label color without specifying label @@ -538,7 +538,7 @@ Features * Permit passing ``format`` keywords when instantiating figures and axes (:commit:`ae98378d`). For example: ``uplt.figure(suptitle='Super title')`` or ``fig.add_subplot(111, xcolor='gray', xticks=10)`` . -* Add back `color` as a valid `ultraplot.axes.CartesianAxes.format` keyword +* Add back `color` as a valid :func:`ultraplot.axes.CartesianAxes.format` keyword arg for consistency with `xcolor` and `ycolor` (:commit:`ecb6fa3f`). Bug fixes @@ -593,7 +593,7 @@ Style changes e.g. ``'yellow'`` different from ``'y'`` (:commit:`01db1223`, :commit:`b90bee8c`). * Make default label rotation for colorbar-of-artist string labels ``0``, consistent with string tick labels applied with ``autoformat=True`` (:commit:`3f191f3b`). -* Use default ``discrete=False`` for `~ultraplot.axes.PlotAxes.hist2d` plots, +* Use default ``discrete=False`` for :func:`~ultraplot.axes.PlotAxes.hist2d` plots, consistent with `~ultraplot.axes.PlotAxes.hexbin` (:commit:`267dd161`). Now "discrete" levels are only enabled for pcolor/contour plots by default. * Trigger ``adjust_grays`` hue adjustments for gray-like color names passed to @@ -620,7 +620,7 @@ Features * Add `align` keyword with options ``'bottom'``, ``'top'``, ``'left'``, ``'right'``, or ``'center'`` (with optional single-char shorthands) to change alignment for outer legends/colorbars (:commit:`4a50b4b2`). Previously they had to be centered. -* Add `transpose` keyword as alternative to `order` for 2D `~ultraplot.axes.PlotAxes` +* Add `transpose` keyword as alternative to `order` for 2D :class:`~ultraplot.axes.PlotAxes` commands (:issue:`72`). ``transpose=True`` is equivalent to ``order='F'``. * Return homogeneous groupings of matplotlib artists in `~matplotlib.cbook.silent_list` objects to simplify repr (:commit:`d59f9c40`, :commit:`667cc068`, @@ -633,7 +633,7 @@ Features `stack` and `stacked`, and make passage of these keywords set the corresponding default `histtype` (:commit:`4a85773b`). Also add `filled` alias of `fill` to `boxplot` for consistency (:commit:`b5caf550`). -* Always copy colormaps returned by `~ultraplot.constructor.Colormap` +* Always copy colormaps returned by :class:`~ultraplot.constructor.Colormap` to avoid subsequently changing global colormap properties with e.g. ``set_alpha`` (:commit:`7a3c3f64`). * Add leading underscore to all default colormap names (``_name_r`` for reversed, @@ -646,9 +646,9 @@ Features (:commit:`58ce2c95`). Colorbar outline is now controlled with `linewidth` and `color`. Previously these settings had to be in sync. * Auto-expand components of `~matplotlib.cbook.silent_list` and - `~matplotlib.collection.Collection` passed to `~ultraplot.axes.Axes.legend` + `~matplotlib.collection.Collection` passed to :class:`~ultraplot.axes.Axes.legend` that have valid labels, similar to tuple group expansion (:issue:`277`) -* Add `handle_kw` to `~ultraplot.axes.Axes.legend` to optionally control +* Add `handle_kw` to :class:`~ultraplot.axes.Axes.legend` to optionally control handle settings that conflict with frame settings (:commit:`58ce2c95`). Example: ``handle_kw={'edgecolor': 'k'}``. * Interpret ``'grey'`` as a synonym of ``'gray'`` by translating substrings in color @@ -677,11 +677,11 @@ Bug fixes input by treating it the same as other color aliases (:issue:`275`). * Fix issue where calling ``legend()`` without arguments generates duplicate labels for histograms (:issue:`277`). -* Fix issue where list-of-list style input to `~ultraplot.axes.Axes.legend` +* Fix issue where list-of-list style input to :class:`~ultraplot.axes.Axes.legend` fails to trigger centered legend (:commit:`e598b470`). * Fix issue where `alpha` passed to contour/pcolor/vlines/hlines commands was ignored due to translating as `alphas` rather than `alpha` (:commit:`e5faf4d6`). -* Fix unexpected behavior where `~ultraplot.axes.PlotAxes` tries to make +* Fix unexpected behavior where :class:`~ultraplot.axes.PlotAxes` tries to make list-of-artist style colorbars from successive calls to 2D plotting commands rather than making individual colorbars (:commit:`20ce93a1`). * Fix issue where ``diverging=True`` is applied for datasets with both @@ -711,7 +711,7 @@ Internals users import ultraplot for the first time (:commit:`9abc894e`). * Remove unused, mostly undocumented :rcraw:`axes.titleabove` setting (:commit:`9d9d0db7`). Users should be using :rcraw:`title.above` instead. -* Move `~ultraplot.gridspec.SubplotGrid` from ``figure.py`` to ``gridspec.py`` +* Move :class:`~ultraplot.gridspec.SubplotGrid` from ``figure.py`` to ``gridspec.py`` (:commit:`7b688fc8`). Makes more sense there. * Improve organization of internal functions, add ``data.py``, ``context.py``, and ``text.py`` to ``internals`` and rename and re-sort related ``PlotAxes`` @@ -726,7 +726,7 @@ Documentation * Update napoleon type aliases and specifiers (:commit:`c20ed1d1`). Use `sequence` instead of `list` wherever params accept arbitrary sequences (:commit:`e627e95b`). * Improve documentation of style-type arguments like `lw`, `linewidth`, - etc. on `~ultraplot.axes.PlotAxes` commands (:commit:`cc602349`). + etc. on :class:`~ultraplot.axes.PlotAxes` commands (:commit:`cc602349`). * Improve documentation of `ultraplot.gridspec.SubplotGrid` methods (:commit:`902502cc`). Docstrings are no longer stubs. @@ -837,12 +837,12 @@ Deprecated (:commit:`e8559f3d`). Confusing since ``get`` didn't accept a "fallback" second positional argument. Now ``get`` is the "dictionary-like" inherited method. * Rename obscure `LinearSegmentedColormap`, `PerceptuallyUniformColormap`, and - `ListedColormap` to more intuitive/succinct `~ultraplot.colors.ContinuousColormap`, - `~ultraplot.colors.PerceptualColormap`, and `~ultraplot.colors.DiscreteColormap` + `ListedColormap` to more intuitive/succinct :class:`~ultraplot.colors.ContinuousColormap`, + :class:`~ultraplot.colors.PerceptualColormap`, and :class:`~ultraplot.colors.DiscreteColormap` (:commit:`ade787f9`). Important due to the "qualitative colormap" behaviors triggered - when a `~ultraplot.colors.DiscreteColormap` is passed to plot commands (see features). + when a :class:`~ultraplot.colors.DiscreteColormap` is passed to plot commands (see features). * Following above change, rename `LinearSegmentedNorm` to simpler `SegmentedNorm`, - rename `~ultraplot.constructor.Colormap` argument `to_listed` to `discrete`, + rename :class:`~ultraplot.constructor.Colormap` argument `to_listed` to `discrete`, change `listmode` options from ``'listed'``, ``'linear'`` to ``'discrete'``, ``'continuous'``, and add `filemode` option (:commit:`ade787f9`, :commit:`5ccd6c01`). * Deprecate ``boxes`` and ``violins`` shorthands in favor of singular @@ -872,7 +872,7 @@ Style changes Controlled by the :rcraw:`axes.inbounds` property, analogous to :rcraw:`cmap.inbounds` used for cmap scaling. This feature leverages ultraplot's input standardization. * Capture `colors` passed to commands like ``contour`` and ``pcolor`` and use - it to build qualitative `~ultraplot.colors.DiscreteColormap` maps (:commit:`6382cf91`). + it to build qualitative :class:`~ultraplot.colors.DiscreteColormap` maps (:commit:`6382cf91`). This matches the behavior of xarray plotting utilities. No longer use `color` to change "edge color" of filled contours/grid boxes. * Add special qualitative cmap handling when ``colors=colors``, ``qualitative=True``, @@ -911,7 +911,7 @@ Features Now e.g. ``uplt.MultipleLocator`` or ``uplt.LogNorm`` are allowed. * Allow creating subplots with `~ultraplot.ui.figure` and either (1) subsequently calling `~ultraplot.figure.Fiugure.subplots` or (2) passing integers or subplot specs - generated by `~ultraplot.gridspec.GridSpec` to `~ultraplot.figure.Figure.add_subplot` + generated by :class:`~ultraplot.gridspec.GridSpec` to `~ultraplot.figure.Figure.add_subplot` (:commit:`51967ce3`). This is convenient for complex grids or mixed proj types. * Add consistent/intuitive aliases `~ultraplot.figure.Figure.subplot` and `~ultraplot.figure.Figure.add_subplots` for native matplotlib commands @@ -921,13 +921,13 @@ Features `~ultraplot.figure.SubplotGrid` after drawing subplots one-by-one (:commit:`fb83384f`). * Implement physical-units `left`, `right`, `top`, `bottom`, `wspace`, and `hspace` - spaces directly on the `~ultraplot.gridspec.GridSpec` rather than externally + spaces directly on the :class:`~ultraplot.gridspec.GridSpec` rather than externally (:commit:`20502345`). Now absolute spaces are always preserved when figure size changes even if tight layout is disabled. -* Have `~ultraplot.gridspec.GridSpec` directly handle "panel slots" (:commit:`20502345`). +* Have :class:`~ultraplot.gridspec.GridSpec` directly handle "panel slots" (:commit:`20502345`). Adding panels to a figure adds row or column "panel slots" to the gridspec and subsequently indexing the gridspec ignores those slots. -* Add tight layout "padding" arguments to `~ultraplot.gridspec.GridSpec` and add gridspec +* Add tight layout "padding" arguments to :class:`~ultraplot.gridspec.GridSpec` and add gridspec parameters as optional arguments to `~ultraplot.figure.Figure` (:commit:`20502345`). When a gridspec is added to the figure the arguments are passed to the gridspec. This replaces matplotlib's `subplotpars` and ``subplots_adjust``. @@ -995,7 +995,7 @@ Features and :rcraw:`gridminor.style` for the respective ``linewidth`` and ``linestyle`` settings (:commit:`a50d5264`) * Permit "registering stuff" by passing files or objects to - `~ultraplot.config.register_cmaps`, `~ultraplot.config.register_cycles`, + :func:`~ultraplot.config.register_cmaps`, `~ultraplot.config.register_cycles`, `~ultraplot.config.register_colors`, and `~ultraplot.config.register_fonts` rather than forcing users to use the ``.ultraplot`` folder (:commit:`ad999e95`). * Support case insensitivity when calling matplotlib's ``unregister_cmap`` @@ -1004,7 +1004,7 @@ Features * Add public `~ultraplot.config.Configurator.changed` property to display a dictionary of settings changed from ultraplot defaults (:commit:`41b5e400`). * Add public `~ultraplot.config.Configurator.user_file` and - `~ultraplot.config.Configurator.user_folder` static methods for displaying + :func:`~ultraplot.config.Configurator.user_folder` static methods for displaying folder locations (:commit:`b11d744a`). * Support XDG directories for ultraplot config files on Linux (:issue:`204`, :commit:`5e6367dc`). Also accept the file ``~/.ultraplotrc`` and the folder @@ -1024,7 +1024,7 @@ Features `~ultraplot.axes.PlotAxes.boxploth` (shorthand `~ultraplot.axes.PlotAxes.boxh`), and `~ultraplot.axes.PlotAxes.violinploth` (shorthand `~ultraplot.axes.PlotAxes.violinh`) commands analogous to `~ultraplot.axes.PlotAxes.barh` (:commit:`6382cf91`). -* Let 1D `~ultraplot.axes.PlotAxes` commands iterate over columns of 2D *x* and *y* +* Let 1D :class:`~ultraplot.axes.PlotAxes` commands iterate over columns of 2D *x* and *y* coordinate arrays instead of only 2D *y* coordinate arrays (:commit:`6382cf91`.) * Support expanded and consistent artist synonyms throughout plotting overrides, e.g. ``ec`` for `edgecolor`, `lw` for `linewidth`, `fc` and `fillcolor` for @@ -1088,7 +1088,7 @@ Features * Add `title_kw`, `suptitle_kw`, `leftlabels_kw`, `rightlabels_kw`, `toplabels_kw`, and `bottomlabels_kw` to `ultraplot.axes.Axes.format` for arbitrarily modifying label text objects -- consistent with `xlabel_kw` and `ylabel_kw` used - for `ultraplot.axes.CartesianAxes.format` (:commit:`6382cf91`). + for :func:`ultraplot.axes.CartesianAxes.format` (:commit:`6382cf91`). Bug fixes --------- @@ -1146,16 +1146,16 @@ Internals --------- * Convert all plotting wrappers to dedicated overrides of individual functions - in `~ultraplot.axes.PlotAxes` class (:commit:`6382cf91`). This massively simplifies + in :class:`~ultraplot.axes.PlotAxes` class (:commit:`6382cf91`). This massively simplifies the internals and makes learning and adopting ultraplot much easier for users. * Implement "panel" tracking and translation of physical spacing units directly - on the `~ultraplot.gridspec.GridSpec` instead of cumbersome hidden methods + on the :class:`~ultraplot.gridspec.GridSpec` instead of cumbersome hidden methods in `~ultraplot.figure.Figure` (:commit:`20502345`). * Validate all setting assignments to `~ultraplot.config.Configurator` using a new `~ultraplot.config.rc_ultraplot` dictionary, analogous to ``rcParams`` (:pr:`109`, :commit:`5626bc88`). This helps avoid mysterious delayed bugs. * Move ``text``, ``legend``, and ``colorbar`` overrides to base `~ultraplot.axes.Axes` - class separate from `~ultraplot.axes.PlotAxes` (:commit:`6382cf91`). + class separate from :class:`~ultraplot.axes.PlotAxes` (:commit:`6382cf91`). * Automatically redirect all internal plotting calls to native matplotlib methods (:commit:`6382cf91`). This significantly improves stability. * Move ``register_colors`` internals from ``config.py`` to ``colors.py`` @@ -1287,9 +1287,9 @@ Features force the tight layout algorithm to make spacings equal (:pr:`215`, :issue:`64`) by `Zachary Moon`_. * Allow calling `ultraplot.colors.PerceptuallyUniformColormap.from_hsl` by passing - `hue`, `saturation`, or `luminance` to `~ultraplot.constructor.Colormap` without + `hue`, `saturation`, or `luminance` to :class:`~ultraplot.constructor.Colormap` without any positional arguments (:commit:`3d8e7dd0`). -* Allow passing `alpha`, `luminance`, `saturation` to `~ultraplot.constructor.Colormap` +* Allow passing `alpha`, `luminance`, `saturation` to :class:`~ultraplot.constructor.Colormap` as lists to be applied to each component cmap (:commit:`3d8e7dd0`). * Add convenient shorthands for channel references throughout colormap functions -- e.g. `h` for hue, `l` for `luminance`, etc. (:commit:`3d8e7dd0`). @@ -1301,7 +1301,7 @@ Features HEX strings by default (:commit:`67488bb1`). Otherwise `scatter` throws warnings. * Use ``90`` as the default `luminance` when creating monochromatic colormaps with `to_listed` set to ``True`` (as when `~ultraplot.constructor.Cycle` calls - `~ultraplot.constructor.Colormap`; :commit:`3d8e7dd0`). + :class:`~ultraplot.constructor.Colormap`; :commit:`3d8e7dd0`). * Add `~ultraplot.axes.Axes.plotx` and `~ultraplot.axes.Axes.scatterx` commands that interpret plotting args as ``(y, x)`` rather than ``(x, y)``, analogous to `~ultraplot.axes.Axes.areax` (:pr:`258`). @@ -1309,7 +1309,7 @@ Features for *horizontal* plotting commands `barh`, `plotx`, and `scatterx` (:pr:`258`). * Add support for ``ax.plot_command('x_key', 'y_key', data=dataset)`` for virtually all plotting commands using `standardize_1d` and `standardize_2d` (:pr:`258`). - This was an existing `~matplotlib.axes.Axes.plot` feature. + This was an existing :func:`~matplotlib.axes.Axes.plot` feature. * Add support for the plotting style ``ax.plot(x1, y1, fmt1, x2, y2, fmt2, ...)`` as allowed by matplotlib (:pr:`258`). * Add `absolute_width` keyword to `~ultraplot.plot.bar_extras` to make `width` @@ -1412,7 +1412,7 @@ Bug fixes * Fix issue where cannot set ``rc.style = 'default'`` (:pr:`240`) by `Pratiman Patel`_. * Fix issue where `get_legend` returns None even with legends present (:issue:`224`). * Fix issue where new child axes reset row/col label settings (:commit:`f32d9703`). -* Fix issue where `~xarray.DataArray` string coordinates are not extracted from +* Fix issue where :class:`~xarray.DataArray` string coordinates are not extracted from container before applying as tick labels (:issue:`214`). * Fix issue where cannot set `extend` other than ``'neither'`` for `~matplotlib.axes.Axes.scatter` colorbars (:issue:`206`). @@ -1626,7 +1626,7 @@ Deprecated wrapper to `~ultraplot.axes.indicate_error` (:pr:`166`, :commit:`d8c50a8d`). * Remove ``'rgbcycle'`` setting (:pr:`166`, :commit:`6653b7f0`). This was complicated to implement/did not add critical functionality. -* Deprecate support for "parametric" plots inside `~matplotlib.axes.Axes.plot`, +* Deprecate support for "parametric" plots inside :func:`~matplotlib.axes.Axes.plot`, instead use `~ultraplot.axes.Axes.parametric` (:commit:`64210bce`). * Change `~ultraplot.utils.units` ``units`` keyword argument to more natural ``dest`` (:commit:`62903b48`). @@ -2018,7 +2018,7 @@ Features `~ultraplot.styletools.show_fonts` to show dummy glyphs to clearly illustrate when fonts are missing characters, but preserve graceful fallback for user. * Improve `~ultraplot.projs.Proj` constructor function. It now accepts - `~cartopy.crs.Projection` and `~mpl_toolkits.basemap.Basemap` instances, + `~cartopy.crs.Projection` and :class:`~mpl_toolkits.basemap.Basemap` instances, just like other constructor functions, and returns only the projection instance (:pr:`92`). * `~ultraplot.rctools.rc` `~ultraplot.rctools.rc_configurator.__getitem__` always diff --git a/docs/1dplots.py b/docs/1dplots.py index c64b2f434..52976f0d8 100644 --- a/docs/1dplots.py +++ b/docs/1dplots.py @@ -24,13 +24,13 @@ # 1D plotting commands # ==================== # -# ultraplot adds :ref:`several new features ` to matplotlib's -# plotting commands using the intermediate `~ultraplot.axes.PlotAxes` class. +# UltraPlot adds :ref:`several new features ` to matplotlib's +# plotting commands using the intermediate :class:`~ultraplot.axes.PlotAxes` class. # For the most part, these additions represent a *superset* of matplotlib -- if # you are not interested, you can use the plotting commands just like you would # in matplotlib. This section documents the features added for 1D plotting commands -# like `~ultraplot.axes.PlotAxes.plot`, `~ultraplot.axes.PlotAxes.scatter`, -# and `~ultraplot.axes.PlotAxes.bar`. +# like :func:`~ultraplot.axes.PlotAxes.plot`, :func:`~ultraplot.axes.PlotAxes.scatter`, +# and :func:`~ultraplot.axes.PlotAxes.bar`. # %% [raw] raw_mimetype="text/restructuredtext" @@ -39,14 +39,14 @@ # Data arguments # -------------- # -# The treatment of data arguments passed to the 1D `~ultraplot.axes.PlotAxes` +# The treatment of data arguments passed to the 1D :class:`~ultraplot.axes.PlotAxes` # commands is standardized. For each command, you can optionally omit # the dependent variable coordinates, in which case they are inferred from the data # (see :ref:`xarray and pandas integration `), or pass # 2D dependent or independent variable coordinates, in which case the # plotting command is called for each column of the 2D array(s). If coordinates # are string labels, they are converted to indices and tick labels using -# `~ultraplot.ticker.IndexLocator` and `~ultraplot.ticker.IndexFormatter`. +# :class:`~ultraplot.ticker.IndexLocator` and :class:`~ultraplot.ticker.IndexFormatter`. # If coordinates are descending and the axis limits are unset, the axis # direction is automatically reversed. All positional arguments can also be # specified as keyword arguments (see the documentation for each plotting command). @@ -54,9 +54,9 @@ # .. note:: # # By default, when choosing the *x* or *y* axis limits, -# ultraplot ignores out-of-bounds data along the other axis if it was explicitly -# fixed by `~matplotlib.axes.Axes.set_xlim` or `~matplotlib.axes.Axes.set_ylim` (or, -# equivalently, by passing `xlim` or `ylim` to `ultraplot.axes.CartesianAxes.format`). +# UltraPlot ignores out-of-bounds data along the other axis if it was explicitly +# fixed by :func:`~matplotlib.axes.Axes.set_xlim` or :func:`~matplotlib.axes.Axes.set_ylim` (or, +# equivalently, by passing `xlim` or `ylim` to :func:`ultraplot.axes.CartesianAxes.format`). # This can be useful if you wish to restrict the view along a "dependent" variable # axis within a large dataset. To disable this feature, pass ``inbounds=False`` to # the plotting command or set :rcraw:`axes.inbounds` to ``False`` (see also @@ -134,7 +134,7 @@ # Pandas and xarray integration # ----------------------------- # -# The 1D `~ultraplot.axes.PlotAxes` commands recognize `pandas`_ +# The 1D :class:`~ultraplot.axes.PlotAxes` commands recognize `pandas`_ # and `xarray`_ data structures. If you omit dependent variable coordinates, # the commands try to infer them from the `pandas.Series`, `pandas.DataFrame`, # or `xarray.DataArray`. If you did not explicitly set the *x* or *y* axis label @@ -145,19 +145,19 @@ # # These features restore some of the convenience you get with the builtin # `pandas`_ and `xarray`_ plotting functions. They are also *optional* -- -# installation of pandas and xarray are not required to use ultraplot. The +# installation of pandas and xarray are not required to use UltraPlot. The # automatic labels can be disabled by setting :rcraw:`autoformat` to ``False`` # or by passing ``autoformat=False`` to any plotting command. # # .. note:: # -# For every plotting command, you can pass a `~xarray.Dataset`, `~pandas.DataFrame`, +# For every plotting command, you can pass a `~xarray.Dataset`, :class:`~pandas.DataFrame`, # or `dict` to the `data` keyword with strings as data arguments instead of arrays # -- just like matplotlib. For example, ``ax.plot('y', data=dataset)`` and # ``ax.plot(y='y', data=dataset)`` are translated to ``ax.plot(dataset['y'])``. # This is the preferred input style for most `seaborn`_ plotting commands. -# Also, if you pass a `pint.Quantity` or `~xarray.DataArray` -# containing a `pint.Quantity`, ultraplot will automatically call +# Also, if you pass a `pint.Quantity` or :class:`~xarray.DataArray` +# containing a `pint.Quantity`, UltraPlot will automatically call # `~pint.UnitRegistry.setup_matplotlib` so that the axes become unit-aware. # %% @@ -216,10 +216,10 @@ # `__ # on-the-fly and use different property cycles for different plot elements. # You can do so using the `cycle` and `cycle_kw` keywords, available -# with most 1D `~ultraplot.axes.PlotAxes` commands. `cycle` and `cycle_kw` are -# passed to the `~ultraplot.constructor.Cycle` :ref:`constructor function +# with most 1D :class:`~ultraplot.axes.PlotAxes` commands. `cycle` and `cycle_kw` are +# passed to the :class:`~ultraplot.constructor.Cycle` :ref:`constructor function # `, and the resulting property cycle is used for the plot. You -# can specify `cycle` once with 2D input data (in which case each column is +# can specify `cycle` once with 3D input data (in which case each column is # plotted in succession according to the property cycle) or call a plotting # command multiple times with the same `cycle` argument (the property # cycle is not reset). You can also disable property cycling with ``cycle=False``, @@ -266,20 +266,20 @@ # Line plots # ---------- # -# Line plots can be drawn with `~ultraplot.axes.PlotAxes.plot` or -# `~ultraplot.axes.PlotAxes.plotx` (or their aliases, `~ultraplot.axes.PlotAxes.line` -# or `~ultraplot.axes.PlotAxes.linex`). For the ``x`` commands, positional +# Line plots can be drawn with :func:`~ultraplot.axes.PlotAxes.plot` or +# :func:`~ultraplot.axes.PlotAxes.plotx` (or their aliases, :func:`~ultraplot.axes.PlotAxes.line` +# or :func:`~ultraplot.axes.PlotAxes.linex`). For the ``x`` commands, positional # arguments are interpreted as *x* coordinates or (*y*, *x*) pairs. This is analogous -# to `~ultraplot.axes.PlotAxes.barh` and `~ultraplot.axes.PlotAxes.fill_betweenx`. -# Also, the default *x* bounds for lines drawn with `~ultraplot.axes.PlotAxes.plot` -# and *y* bounds for lines drawn with `~ultraplot.axes.PlotAxes.plotx` are now +# to :func:`~ultraplot.axes.PlotAxes.barh` and :func:`~ultraplot.axes.PlotAxes.fill_betweenx`. +# Also, the default *x* bounds for lines drawn with :func:`~ultraplot.axes.PlotAxes.plot` +# and *y* bounds for lines drawn with :func:`~ultraplot.axes.PlotAxes.plotx` are now # "sticky", i.e. there is no padding between the lines and axes edges by default. # -# Step and stem plots can be drawn with `~ultraplot.axes.PlotAxes.step`, -# `~ultraplot.axes.PlotAxes.stepx`, `~ultraplot.axes.PlotAxes.stem`, and -# `~ultraplot.axes.PlotAxes.stemx`. Plots of parallel vertical and horizontal -# lines can be drawn with `~ultraplot.axes.PlotAxes.vlines` and -# `~ultraplot.axes.PlotAxes.hlines`. You can have different colors for "negative" and +# Step and stem plots can be drawn with :func:`~ultraplot.axes.PlotAxes.step`, +# :func:`~ultraplot.axes.PlotAxes.stepx`, :func:`~ultraplot.axes.PlotAxes.stem`, and +# :func:`~ultraplot.axes.PlotAxes.stemx`. Plots of parallel vertical and horizontal +# lines can be drawn with :func:`~ultraplot.axes.PlotAxes.vlines` and +# :func:`~ultraplot.axes.PlotAxes.hlines`. You can have different colors for "negative" and # "positive" lines using ``negpos=True`` (see :ref:`below ` for details). # %% @@ -328,35 +328,35 @@ # Scatter plots # ------------- # -# The `~ultraplot.axes.PlotAxes.scatter` command now permits omitting *x* -# coordinates and accepts 2D *y* coordinates, just like `~ultraplot.axes.PlotAxes.plot`. -# As with `~ultraplot.axes.PlotAxes.plotx`, the `~ultraplot.axes.PlotAxes.scatterx` -# command is just like `~ultraplot.axes.PlotAxes.scatter`, except positional +# The :func:`~ultraplot.axes.PlotAxes.scatter` command now permits omitting *x* +# coordinates and accepts 2D *y* coordinates, just like :func:`~ultraplot.axes.PlotAxes.plot`. +# As with :func:`~ultraplot.axes.PlotAxes.plotx`, the :func:`~ultraplot.axes.PlotAxes.scatterx` +# command is just like :func:`~ultraplot.axes.PlotAxes.scatter`, except positional # arguments are interpreted as *x* coordinates and (*y*, *x*) pairs. -# `~ultraplot.axes.PlotAxes.scatter` also now accepts keywords -# that look like `~ultraplot.axes.PlotAxes.plot` keywords (e.g., `color` instead of -# `c` and `markersize` instead of `s`). This way, `~ultraplot.axes.PlotAxes.scatter` +# :func:`~ultraplot.axes.PlotAxes.scatter` also now accepts keywords +# that look like :func:`~ultraplot.axes.PlotAxes.plot` keywords (e.g., `color` instead of +# `c` and `markersize` instead of `s`). This way, :func:`~ultraplot.axes.PlotAxes.scatter` # can be used to simply "plot markers, not lines" without changing the input -# arguments relative to `~ultraplot.axes.PlotAxes.plot`. +# arguments relative to :func:`~ultraplot.axes.PlotAxes.plot`. # -# The property cycler used by `~ultraplot.axes.PlotAxes.scatter` can be changed +# The property cycler used by :func:`~ultraplot.axes.PlotAxes.scatter` can be changed # using the `cycle` keyword argument, and unlike matplotlib it can include # properties like `marker` and `markersize`. The colormap `cmap` and normalizer # `norm` used with the optional `c` color array are now passed through the -# `~ultraplot.constructor.Colormap` and `~ultraplot.constructor.Norm` constructor +# :class:`~ultraplot.constructor.Colormap` and :class:`~ultraplot.constructor.Norm` constructor # functions. # .. important:: # # In matplotlib, arrays passed to the marker size keyword `s` always represent the -# area in units ``points ** 2``. In ultraplot, arrays passed to `s` are scaled so +# area in units ``points ** 2``. In UltraPlot, arrays passed to `s` are scaled so # that the minimum data value has the area ``1`` while the maximum data value # has the area :rcraw:`lines.markersize` squared. These minimum and maximum marker # sizes can also be specified manually with the `smin` and `smax` keywords, # analogous to `vmin` and `vmax` used to scale the color array `c`. This feature -# can be disabled by passing ``absolute_size=True`` to `~ultraplot.axes.Axes.scatter` -# or `~ultraplot.axes.Axes.scatterx`. This is done automatically when `seaborn`_ -# calls `~ultraplot.axes.Axes.scatter` internally. +# can be disabled by passing ``absolute_size=True`` to :func:`~ultraplot.axes.Axes.scatter` +# or :func:`~ultraplot.axes.Axes.scatterx`. This is done automatically when `seaborn`_ +# calls :func:`~ultraplot.axes.Axes.scatter` internally. # %% import ultraplot as uplt @@ -413,13 +413,13 @@ # Parametric plots # ---------------- # -# Parametric plots can be drawn using the new `~ultraplot.axes.PlotAxes.parametric` -# command. This creates `~matplotlib.collections.LineCollection`\ s that map +# Parametric plots can be drawn using the new :func:`~ultraplot.axes.PlotAxes.parametric` +# command. This creates :class:`~matplotlib.collections.LineCollection`\ s that map # individual line segments to individual colors, where each segment represents a # "parametric" coordinate (e.g., time). The parametric coordinates are specified with # a third positional argument or with the keywords `c`, `color`, `colors` or `values`. # Representing parametric coordinates with colors instead of text labels can be -# cleaner. The below example makes a simple `~ultraplot.axes.PlotAxes.parametric` +# cleaner. The below example makes a simple :func:`~ultraplot.axes.PlotAxes.parametric` # plot with a colorbar indicating the parametric coordinate. # %% @@ -483,7 +483,7 @@ # Bar plots and area plots # ------------------------ # -# The `~ultraplot.axes.PlotAxes.bar` and `~ultraplot.axes.PlotAxes.barh` commands +# The :func:`~ultraplot.axes.PlotAxes.bar` and :func:`~ultraplot.axes.PlotAxes.barh` commands # apply default *x* or *y* coordinates if you failed to provide them explicitly # and can *group* or *stack* successive columns of data if you pass 2D arrays instead # of 1D arrays -- just like `pandas`_. When bars are grouped, their widths and @@ -491,31 +491,31 @@ # is the default behavior and stacking can be enabled with ``stack=True`` # or ``stacked=True``. # -# The `~ultraplot.axes.PlotAxes.fill_between` and `~ultraplot.axes.PlotAxes.fill_betweenx` -# commands have the new shorthands `~ultraplot.axes.PlotAxes.area` -# and `~ultraplot.axes.PlotAxes.areax`. Similar to `~ultraplot.axes.PlotAxes.bar` and -# `~ultraplot.axes.PlotAxes.barh`, they apply default *x* coordinates if you failed +# The :func:`~ultraplot.axes.PlotAxes.fill_between` and :func:`~ultraplot.axes.PlotAxes.fill_betweenx` +# commands have the new shorthands :func:`~ultraplot.axes.PlotAxes.area` +# and :func:`~ultraplot.axes.PlotAxes.areax`. Similar to :func:`~ultraplot.axes.PlotAxes.bar` and +# :func:`~ultraplot.axes.PlotAxes.barh`, they apply default *x* coordinates if you failed # to provide them explicitly, and can *overlay* or *stack* successive columns of # data if you pass 2D arrays instead of 1D arrays -- just like `pandas`_. Overlaying # is the default behavior but stacking can be enabled with ``stack=True`` or # ``stacked=True``. Also note the default *x* bounds for shading drawn with -# `~ultraplot.axes.PlotAxes.area` and *y* bounds for shading drawn with -# `~ultraplot.axes.PlotAxes.areax` is now "sticky", i.e. there is no padding +# :func:`~ultraplot.axes.PlotAxes.area` and *y* bounds for shading drawn with +# :func:`~ultraplot.axes.PlotAxes.areax` is now "sticky", i.e. there is no padding # between the shading and axes edges by default. # .. important:: # -# In matplotlib, bar widths for horizontal `~matplotlib.axes.Axes.barh` plots -# are expressed with the `height` keyword. In ultraplot, bar widths are always +# In matplotlib, bar widths for horizontal :func:`~matplotlib.axes.Axes.barh` plots +# are expressed with the `height` keyword. In UltraPlot, bar widths are always # expressed with the `width` keyword. Note that bar widths can also be passed # as a third positional argument. # Additionally, matplotlib bar widths are always expressed in data units, -# while ultraplot bar widths are expressed in step size-relative units by +# while UltraPlot bar widths are expressed in step size-relative units by # default. For example, ``width=1`` with a dependent coordinate step # size of ``2`` fills 100% of the space between each bar rather than 50%. This -# can be disabled by passing ``absolute_width=True`` to `~ultraplot.axes.Axes.bar` -# or `~ultraplot.axes.Axes.barh`. This is done automatically when `seaborn`_ calls -# `~ultraplot.axes.Axes.bar` or `~ultraplot.axes.Axes.barh` internally. +# can be disabled by passing ``absolute_width=True`` to :func:`~ultraplot.axes.Axes.bar` +# or :func:`~ultraplot.axes.Axes.barh`. This is done automatically when `seaborn`_ calls +# :func:`~ultraplot.axes.Axes.bar` or :func:`~ultraplot.axes.Axes.barh` internally. # %% import ultraplot as uplt @@ -604,13 +604,13 @@ # # You can use different colors for "negative" and # "positive" data by passing ``negpos=True`` to any of the -# `~ultraplot.axes.PlotAxes.fill_between`, `~ultraplot.axes.PlotAxes.fill_betweenx` -# (shorthands `~ultraplot.axes.PlotAxes.area`, `~ultraplot.axes.PlotAxes.areax`), -# `~ultraplot.axes.PlotAxes.vlines`, `~ultraplot.axes.PlotAxes.hlines`, -# `~ultraplot.axes.PlotAxes.bar`, or `~ultraplot.axes.PlotAxes.barh` commands. +# :func:`~ultraplot.axes.PlotAxes.fill_between`, :func:`~ultraplot.axes.PlotAxes.fill_betweenx` +# (shorthands :func:`~ultraplot.axes.PlotAxes.area`, :func:`~ultraplot.axes.PlotAxes.areax`), +# :func:`~ultraplot.axes.PlotAxes.vlines`, :func:`~ultraplot.axes.PlotAxes.hlines`, +# :func:`~ultraplot.axes.PlotAxes.bar`, or :func:`~ultraplot.axes.PlotAxes.barh` commands. # The default negative and positive colors are controlled with :rcraw:`negcolor` and # :rcraw:`poscolor` but the colors can be modified for particular plots by passing -# ``negcolor=color`` and ``poscolor=color`` to the `~ultraplot.axes.PlotAxes` commands. +# ``negcolor=color`` and ``poscolor=color`` to the :class:`~ultraplot.axes.PlotAxes` commands. # %% import ultraplot as uplt diff --git a/docs/2dplots.py b/docs/2dplots.py index 4899b9199..3f27b7b56 100644 --- a/docs/2dplots.py +++ b/docs/2dplots.py @@ -24,22 +24,22 @@ # 2D plotting commands # ==================== # -# ultraplot adds :ref:`several new features ` to matplotlib's -# plotting commands using the intermediate `~ultraplot.axes.PlotAxes` class. +# UltraPlot adds :ref:`several new features ` to matplotlib's +# plotting commands using the intermediate :class:`~ultraplot.axes.PlotAxes` class. # For the most part, these additions represent a *superset* of matplotlib -- if # you are not interested, you can use the plotting commands just like you would # in matplotlib. This section documents the features added for 2D plotting commands -# like `~ultraplot.axes.PlotAxes.contour`, `~ultraplot.axes.PlotAxes.pcolor`, -# and `~ultraplot.axes.PlotAxes.imshow`. +# like :func:`~ultraplot.axes.PlotAxes.contour`, :func:`~ultraplot.axes.PlotAxes.pcolor`, +# and :func:`~ultraplot.axes.PlotAxes.imshow`. # # .. important:: # -# By default, ultraplot automatically adjusts the width of -# `~ultraplot.axes.PlotAxes.contourf` and `~ultraplot.axes.PlotAxes.pcolor` edges +# By default, UltraPlot automatically adjusts the width of +# :func:`~ultraplot.axes.PlotAxes.contourf` and :func:`~ultraplot.axes.PlotAxes.pcolor` edges # to eliminate the appearance of `"white lines" in saved vector graphic files # `__. However, this can significantly # slow down the drawing time for large datasets. To disable this feature, -# pass ``edgefix=False`` to the relevant `~ultraplot.axes.PlotAxes` command, +# pass ``edgefix=False`` to the relevant :class:`~ultraplot.axes.PlotAxes` command, # or set :rcraw:`edgefix` to ``False`` to disable globally. # %% [raw] raw_mimetype="text/restructuredtext" @@ -48,18 +48,18 @@ # Data arguments # -------------- # -# The treatment of data arguments passed to the 2D `~ultraplot.axes.PlotAxes` +# The treatment of data arguments passed to the 2D :class:`~ultraplot.axes.PlotAxes` # commands is standardized. For each command, you can optionally omit the *x* # and *y* coordinates, in which case they are inferred from the data # (see :ref:`xarray and pandas integration `). If coordinates # are string labels, they are converted to indices and tick labels using -# `~ultraplot.ticker.IndexLocator` and `~ultraplot.ticker.IndexFormatter`. +# :class:`~ultraplot.ticker.IndexLocator` and :class:`~ultraplot.ticker.IndexFormatter`. # If coordinates are descending and the axis limits are unset, the axis # direction is automatically reversed. If coordinate *centers* are passed to commands -# like `~ultraplot.axes.PlotAxes.pcolor` and `~ultraplot.axes.PlotAxes.pcolormesh`, they -# are automatically converted to edges using `~ultraplot.utils.edges` or -# `~ultraplot.utils.edges2d`, and if coordinate *edges* are passed to commands like -# `~ultraplot.axes.PlotAxes.contour` and `~ultraplot.axes.PlotAxes.contourf`, they are +# like :func:`~ultraplot.axes.PlotAxes.pcolor` and :func:`~ultraplot.axes.PlotAxes.pcolormesh`, they +# are automatically converted to edges using :func:`~ultraplot.utils.edges` or +# `:func:`~ultraplot.utils.edges2d``, and if coordinate *edges* are passed to commands like +# :func:`~ultraplot.axes.PlotAxes.contour` and :func:`~ultraplot.axes.PlotAxes.contourf`, they are # automatically converted to centers (notice the locations of the rectangle edges # in the ``pcolor`` plots below). All positional arguments can also be specified # as keyword arguments (see the documentation for each plotting command). @@ -67,10 +67,10 @@ # .. note:: # # By default, when choosing the colormap :ref:`normalization -# range `, ultraplot ignores data outside the *x* or *y* axis -# limits if they were previously fixed by `~matplotlib.axes.Axes.set_xlim` or -# `~matplotlib.axes.Axes.set_ylim` (or, equivalently, by passing `xlim` or -# `ylim` to `ultraplot.axes.CartesianAxes.format`). This can be useful if you +# range `, UltraPlot ignores data outside the *x* or *y* axis +# limits if they were previously fixed by :func:`~matplotlib.axes.Axes.set_xlim` or +# :func:`~matplotlib.axes.Axes.set_ylim` (or, equivalently, by passing `xlim` or +# `ylim` to :func:`ultraplot.axes.CartesianAxes.format`). This can be useful if you # wish to restrict the view along the *x* or *y* axis within a large dataset. # To disable this feature, pass ``inbounds=False`` to the plotting command or # set :rcraw:`cmap.inbounds` to ``False`` (see also the :rcraw:`axes.inbounds` @@ -157,7 +157,7 @@ # Pandas and xarray integration # ----------------------------- # -# The 2D `~ultraplot.axes.PlotAxes` commands recognize `pandas`_ +# The 2D :class:`~ultraplot.axes.PlotAxes` commands recognize `pandas`_ # and `xarray`_ data structures. If you omit *x* and *y* coordinates, # the commands try to infer them from the `pandas.DataFrame` or # `xarray.DataArray`. If you did not explicitly set the *x* or *y* axis label @@ -168,19 +168,19 @@ # # These features restore some of the convenience you get with the builtin # `pandas`_ and `xarray`_ plotting functions. They are also *optional* -- -# installation of pandas and xarray are not required to use ultraplot. The +# installation of pandas and xarray are not required to use UltraPlot. The # automatic labels can be disabled by setting :rcraw:`autoformat` to ``False`` # or by passing ``autoformat=False`` to any plotting command. # # .. note:: # -# For every plotting command, you can pass a `~xarray.Dataset`, `~pandas.DataFrame`, +# For every plotting command, you can pass a `~xarray.Dataset`, :class:`~pandas.DataFrame`, # or `dict` to the `data` keyword with strings as data arguments instead of arrays # -- just like matplotlib. For example, ``ax.plot('y', data=dataset)`` and # ``ax.plot(y='y', data=dataset)`` are translated to ``ax.plot(dataset['y'])``. # This is the preferred input style for most `seaborn`_ plotting commands. -# Also, if you pass a `pint.Quantity` or `~xarray.DataArray` -# containing a `pint.Quantity`, ultraplot will automatically call +# Also, if you pass a `pint.Quantity` or :class:`~xarray.DataArray` +# containing a `pint.Quantity`, UltraPlot will automatically call # `~pint.UnitRegistry.setup_matplotlib` so that the axes become unit-aware. # %% @@ -244,15 +244,15 @@ # --------------------- # # It is often useful to create custom colormaps on-the-fly, -# without explicitly calling the `~ultraplot.constructor.Colormap` +# without explicitly calling the :class:`~ultraplot.constructor.Colormap` # :ref:`constructor function `. You can do so using the `cmap` -# and `cmap_kw` keywords, available with most `~ultraplot.axes.PlotAxes` 2D plot +# and `cmap_kw` keywords, available with most :class:`~ultraplot.axes.PlotAxes` 2D plot # commands. For example, to create and apply a monochromatic colormap, you can use # ``cmap='color_name'`` (see the :ref:`colormaps section ` for more info). -# You can also create on-the-fly "qualitative" `~ultraplot.colors.DiscreteColormap`\ s +# You can also create on-the-fly "qualitative" :class:`~ultraplot.colors.DiscreteColormap`\ s # by passing lists of colors to the keyword `c`, `color`, or `colors`. # -# ultraplot defines :ref:`global defaults ` for four different colormap +# UltraPlot defines :ref:`global defaults ` for four different colormap # types: :ref:`sequential ` (setting :rcraw:`cmap.sequential`), # :ref:`diverging ` (setting :rcraw:`cmap.diverging`), # :ref:`cyclic ` (setting :rcraw:`cmap.cyclic`), @@ -347,7 +347,7 @@ # Special normalizers # ------------------- # -# ultraplot includes two new :ref:`"continuous" normalizers `. The +# UltraPlot includes two new :ref:`"continuous" normalizers `. The # `~ultraplot.colors.SegmentedNorm` normalizer provides even color gradations with respect # to index for an arbitrary monotonically increasing or decreasing list of levels. This # is automatically applied if you pass unevenly spaced `levels` to a plotting command, @@ -429,9 +429,9 @@ # Discrete levels # --------------- # -# By default, ultraplot uses `~ultraplot.colors.DiscreteNorm` to "discretize" -# the possible colormap colors for contour and pseudocolor `~ultraplot.axes.PlotAxes` -# commands (e.g., `~ultraplot.axes.PlotAxes.contourf`, `~ultraplot.axes.PlotAxes.pcolor`). +# By default, UltraPlot uses `~ultraplot.colors.DiscreteNorm` to "discretize" +# the possible colormap colors for contour and pseudocolor :class:`~ultraplot.axes.PlotAxes` +# commands (e.g., :func:`~ultraplot.axes.PlotAxes.contourf`, :func:`~ultraplot.axes.PlotAxes.pcolor`). # This is analogous to `matplotlib.colors.BoundaryNorm`, except # `~ultraplot.colors.DiscreteNorm` can be paired with arbitrary # continuous normalizers specified by `norm` (see :ref:`above `). @@ -448,7 +448,7 @@ # or pass ``discrete=False`` or ``discrete=True`` to any plotting command # that accepts a `cmap` argument. The level edges or centers used with # `~ultraplot.colors.DiscreteNorm` can be explicitly specified using the `levels` or -# `values` keywords, respectively (`~ultraplot.utils.arange` and `~ultraplot.utils.edges` +# `values` keywords, respectively (:func:`~ultraplot.utils.arange` and :func:`~ultraplot.utils.edges` # are useful for generating `levels` and `values` lists). You can also pass an integer # to these keywords (or to the `N` keyword) to automatically generate approximately this # many level edges or centers at "nice" intervals. The algorithm used to generate levels @@ -460,7 +460,7 @@ # ` for more on locators). You can also use the keywords `negative`, # `positive`, or `symmetric` to ensure that your levels are strictly negative, # positive, or symmetric about zero, or use the `nozero` keyword to remove -# the zero level (useful for single-color `~ultraplot.axes.PlotAxes.contour` plots). +# the zero level (useful for single-color :func:`~ultraplot.axes.PlotAxes.contour` plots). # %% import ultraplot as uplt @@ -529,10 +529,10 @@ # # By default, colormaps are normalized to span from roughly the minimum # data value to the maximum data value. However in the presence of outliers, -# this is not desirable. ultraplot adds the `robust` keyword to change this +# this is not desirable. UltraPlot adds the `robust` keyword to change this # behavior, inspired by the `xarray keyword # `__ -# of the same name. Passing ``robust=True`` to a `~ultraplot.axes.PlotAxes` +# of the same name. Passing ``robust=True`` to a :class:`~ultraplot.axes.PlotAxes` # 2D plot command will limit the default colormap normalization between # the 2nd and 98th data percentiles. This range can be customized by passing # an integer to `robust` (e.g. ``robust=90`` limits the normalization range @@ -543,10 +543,10 @@ # # Additionally, `similar to xarray # `__, -# ultraplot can automatically detect "diverging" datasets. By default, -# the 2D `~ultraplot.axes.PlotAxes` commands will apply the diverging colormap +# UltraPlot can automatically detect "diverging" datasets. By default, +# the 2D :class:`~ultraplot.axes.PlotAxes` commands will apply the diverging colormap # :rc:`cmap.diverging` (rather than :rc:`cmap.sequential`) and the diverging -# normalizer `~ultraplot.colors.DivergingNorm` (rather than `~matplotlib.colors.Normalize` +# normalizer `~ultraplot.colors.DivergingNorm` (rather than :class:`~matplotlib.colors.Normalize` # -- see :ref:`above `) if the following conditions are met: # # #. If discrete levels are enabled (see :ref:`above `) and the @@ -592,14 +592,14 @@ # Quick labels # ------------ # -# You can now quickly add labels to `~ultraplot.axes.PlotAxes.contour`, -# `~ultraplot.axes.PlotAxes.contourf`, `~ultraplot.axes.PlotAxes.pcolor`, -# `~ultraplot.axes.PlotAxes.pcolormesh`, and `~ultraplot.axes.PlotAxes.heatmap`, +# You can now quickly add labels to :func:`~ultraplot.axes.PlotAxes.contour`, +# :func:`~ultraplot.axes.PlotAxes.contourf`, :func:`~ultraplot.axes.PlotAxes.pcolor`, +# :func:`~ultraplot.axes.PlotAxes.pcolormesh`, and :func:`~ultraplot.axes.PlotAxes.heatmap`, # plots by passing ``labels=True`` to the plotting command. The # label text is colored black or white depending on the luminance of the underlying # grid box or filled contour (see the section on :ref:`colorspaces `). # Contour labels are drawn with `~matplotlib.axes.Axes.clabel` and grid box -# labels are drawn with `~ultraplot.axes.Axes.text`. You can pass keyword arguments +# labels are drawn with :func:`~ultraplot.axes.Axes.text`. You can pass keyword arguments # to these functions by passing a dictionary to `labels_kw`, and you can # change the label precision using the `precision` keyword. See the plotting # command documentation for details. @@ -653,13 +653,13 @@ # Heatmap plots # ------------- # -# The `~ultraplot.axes.PlotAxes.heatmap` command can be used to draw "heatmaps" of +# The :func:`~ultraplot.axes.PlotAxes.heatmap` command can be used to draw "heatmaps" of # 2-dimensional data. This is a convenience function equivalent to -# `~ultraplot.axes.PlotAxes.pcolormesh`, except the axes are configured with settings +# :func:`~ultraplot.axes.PlotAxes.pcolormesh`, except the axes are configured with settings # suitable for heatmaps: fixed aspect ratios (ensuring "square" grid boxes), no # gridlines, no minor ticks, and major ticks at the center of each box. Among other # things, this is useful for displaying covariance and correlation matrices, as shown -# below. `~ultraplot.axes.PlotAxes.heatmap` should generally only be used with +# below. :func:`~ultraplot.axes.PlotAxes.heatmap` should generally only be used with # `~ultraplot.axes.CartesianAxes`. # %% diff --git a/docs/api.rst b/docs/api.rst index e8c2361f1..5332d35b2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -8,8 +8,8 @@ The comprehensive API reference. All of the below objects are imported into the top-level namespace. Use ``help(uplt.object)`` to read the docs during a python session. -Please note that ultraplot removes the associated documentation when functionality -is deprecated (see :ref:`What's New `). However, ultraplot adheres to +Please note that UltraPlot removes the associated documentation when functionality +is deprecated (see :ref:`What's New `). However, UltraPlot adheres to `semantic versioning `__, which means old code that uses deprecated functionality will still work and issue warnings rather than errors until the first major release (version 1.0.0). @@ -17,15 +17,16 @@ until the first major release (version 1.0.0). .. important:: The documentation for "wrapper" functions like `standardize_1d` and `cmap_changer` - from ultraplot < 0.8.0 can now be found under individual `~ultraplot.axes.PlotAxes` - methods like `~ultraplot.axes.PlotAxes.plot` and `~ultraplot.axes.PlotAxes.pcolor`. Note - that calling ``help(ax.method)`` in a python session will show both the ultraplot + from UltraPlot < 0.8.0 can now be found under individual :class:`~ultraplot.axes.PlotAxes` + methods like :func:`~ultraplot.axes.PlotAxes.plot` and :func:`~ultraplot.axes.PlotAxes.pcolor`. Note + that calling ``help(ax.method)`` in a python session will show both the UltraPlot documentation and the original matplotlib documentation. Figure class ============ .. automodule:: ultraplot.figure + :no-private-members: .. automodsumm:: ultraplot.figure :toctree: api @@ -35,6 +36,9 @@ Grid classes ============ .. automodule:: ultraplot.gridspec + :no-private-members: + + .. automodsumm:: ultraplot.gridspec :toctree: api @@ -45,6 +49,7 @@ Axes classes ============ .. automodule:: ultraplot.axes + :no-private-members: .. automodsumm:: ultraplot.axes :toctree: api @@ -54,6 +59,7 @@ Top-level functions =================== .. automodule:: ultraplot.ui + :no-private-members: .. automodsumm:: ultraplot.ui :toctree: api @@ -63,6 +69,7 @@ Configuration tools =================== .. automodule:: ultraplot.config + :no-private-members: .. automodsumm:: ultraplot.config :toctree: api @@ -73,6 +80,7 @@ Constructor functions ===================== .. automodule:: ultraplot.constructor + :no-private-members: .. automodsumm:: ultraplot.constructor :toctree: api @@ -83,6 +91,7 @@ Locators and formatters ======================= .. automodule:: ultraplot.ticker + :no-private-members: .. automodsumm:: ultraplot.ticker :toctree: api @@ -92,6 +101,7 @@ Axis scale classes ================== .. automodule:: ultraplot.scale + :no-private-members: .. automodsumm:: ultraplot.scale :toctree: api @@ -101,6 +111,7 @@ Colormaps and normalizers ========================= .. automodule:: ultraplot.colors + :no-private-members: .. automodsumm:: ultraplot.colors :toctree: api @@ -111,6 +122,7 @@ Projection classes ================== .. automodule:: ultraplot.proj + :no-private-members: .. automodsumm:: ultraplot.proj :toctree: api @@ -120,6 +132,7 @@ Demo functions ============== .. automodule:: ultraplot.demos + :no-private-members: .. automodsumm:: ultraplot.demos :toctree: api @@ -129,6 +142,7 @@ Miscellaneous functions ======================= .. automodule:: ultraplot.utils + :no-private-members: .. automodsumm:: ultraplot.utils :toctree: api diff --git a/docs/authors.rst b/docs/authors.rst index ebba84458..c64e06666 100644 --- a/docs/authors.rst +++ b/docs/authors.rst @@ -39,8 +39,8 @@ as an avid vim user. `Riley Brady`_ is the next-biggest contributor. He helped Luke set up automatic testing, deploy this project to PyPi, and improve new user experience. He is -also ultraplot's earliest user and helped fix `lots of early bugs -`__. +also UltraPlot's earliest user and helped fix `lots of early bugs +`__. .. _Luke Davis: https://github.com/lukelbd diff --git a/docs/basics.py b/docs/basics.py index aee847fc7..d94bf6e8b 100644 --- a/docs/basics.py +++ b/docs/basics.py @@ -24,40 +24,40 @@ # Creating figures # ---------------- # -# ultraplot works by `subclassing +# UltraPlot works by `subclassing # `__ -# three fundamental matplotlib classes: `ultraplot.figure.Figure` replaces -# `matplotlib.figure.Figure`, `ultraplot.axes.Axes` replaces `matplotlib.axes.Axes`, -# and `ultraplot.gridspec.GridSpec` replaces `matplotlib.gridspec.GridSpec` +# three fundamental matplotlib classes: :class:`ultraplot.figure.Figure` replaces +# :class:`matplotlib.figure.Figure`, :class:`ultraplot.axes.Axes` replaces :class:`matplotlib.axes.Axes`, +# and :class:`ultraplot.gridspec.GridSpec` replaces :class:`matplotlib.gridspec.GridSpec` # (see this `tutorial # `__ # for more on gridspecs). # # To make plots with these classes, you must start with the top-level commands -# `~ultraplot.ui.figure`, `~ultraplot.ui.subplot`, or `~ultraplot.ui.subplots`. These are -# modeled after the `~matplotlib.pyplot` commands of the same name. As in -# `~matplotlib.pyplot`, `~ultraplot.ui.subplot` creates a figure and a single -# subplot, `~ultraplot.ui.subplots` creates a figure and a grid of subplots, and -# `~ultraplot.ui.figure` creates an empty figure that can be subsequently filled +# :func:`~ultraplot.ui.figure`, :func:`~ultraplot.ui.subplot`, or :func:`~ultraplot.ui.subplots`. These are +# modeled after the :func:`~matplotlib.pyplot` commands of the same name. As in +# :func:`~matplotlib.pyplot`, :func:`~ultraplot.ui.subplot` creates a figure and a single +# subplot, :func:`~ultraplot.ui.subplots` creates a figure and a grid of subplots, and +# :func:`~ultraplot.ui.figure` creates an empty figure that can be subsequently filled # with subplots. A minimal example with just one subplot is shown below. # # %% [raw] raw_mimetype="text/restructuredtext" # .. note:: # -# ultraplot changes the default :rcraw:`figure.facecolor` +# UltraPlot changes the default :rcraw:`figure.facecolor` # so that the figure backgrounds shown by the `matplotlib backend # `__ are light gray # (the :rcraw:`savefig.facecolor` applied to saved figures is still white). -# ultraplot also controls the appearance of figures in Jupyter notebooks +# UltraPlot also controls the appearance of figures in Jupyter notebooks # using the new :rcraw:`inlineformat` setting, which is passed to -# `~ultraplot.config.config_inline_backend` on import. This +# :func:`~ultraplot.config.config_inline_backend` on import. This # imposes a higher-quality default `"inline" format # `__ # and disables the backend-specific settings ``InlineBackend.rc`` and # ``InlineBackend.print_figure_kwargs``, ensuring that the figures you save # look like the figures displayed by the backend. # -# ultraplot also changes the default :rcraw:`savefig.format` +# UltraPlot also changes the default :rcraw:`savefig.format` # from PNG to PDF for the following reasons: # # #. Vector graphic formats are infinitely scalable. @@ -67,7 +67,7 @@ # #. The EPS format is outdated and does not support transparent graphic # elements. # -# In case you *do* need a raster format like PNG, ultraplot increases the +# In case you *do* need a raster format like PNG, UltraPlot increases the # default :rcraw:`savefig.dpi` to 1000 dots per inch, which is # `recommended `__ by most journals # as the minimum resolution for figures containing lines and text. See the @@ -95,47 +95,47 @@ # # Similar to matplotlib, subplots can be added to figures one-by-one # or all at once. Each subplot will be an instance of -# `ultraplot.axes.Axes`. To add subplots all at once, use -# `ultraplot.figure.Figure.add_subplots` (or its shorthand, -# `ultraplot.figure.Figure.subplots`). Note that under the hood, the top-level -# ultraplot command `~ultraplot.ui.subplots` simply calls `~ultraplot.ui.figure` -# followed by `ultraplot.figure.Figure.add_subplots`. -# -# * With no arguments, `~ultraplot.figure.Figure.add_subplots` returns a subplot -# generated from a 1-row, 1-column `~ultraplot.gridspec.GridSpec`. -# * With `ncols` or `nrows`, `~ultraplot.figure.Figure.add_subplots` returns a -# simple grid of subplots from a `~ultraplot.gridspec.GridSpec` with +# :class:`ultraplot.axes.Axes`. To add subplots all at once, use +# :func:`ultraplot.figure.Figure.add_subplots` (or its shorthand, +# :func:`ultraplot.figure.Figure.subplots`). Note that under the hood, the top-level +# UltraPlot command :func:`~ultraplot.ui.subplots` simply calls :class::func:`~ultraplot.ui.figure` +# followed by :func:`ultraplot.figure.Figure.add_subplots`. +# +# * With no arguments, :func:`~ultraplot.figure.Figure.add_subplots` returns a subplot +# generated from a 1-row, 1-column :class:`~ultraplot.gridspec.GridSpec`. +# * With `ncols` or `nrows`, :func:`~ultraplot.figure.Figure.add_subplots` returns a +# simple grid of subplots from a :class:`~ultraplot.gridspec.GridSpec` with # matching geometry in either row-major or column-major `order`. -# * With `array`, `~ultraplot.figure.Figure.add_subplots` returns an arbitrarily -# complex grid of subplots from a `~ultraplot.gridspec.GridSpec` with matching +# * With `array`, :func:`~ultraplot.figure.Figure.add_subplots` returns an arbitrarily +# complex grid of subplots from a :class:`~ultraplot.gridspec.GridSpec` with matching # geometry. Here `array` is a 2D array representing a "picture" of the subplot # layout, where each unique integer indicates a `~matplotlib.gridspec.GridSpec` # slot occupied by the corresponding subplot and ``0`` indicates an empty space. -# The returned subplots are contained in a `~ultraplot.gridspec.SubplotGrid` +# The returned subplots are contained in a :class:`~ultraplot.gridspec.SubplotGrid` # (:ref:`see below ` for details). # -# To add subplots one-by-one, use the `ultraplot.figure.Figure.add_subplot` -# command (or its shorthand `ultraplot.figure.Figure.subplot`). +# To add subplots one-by-one, use the :func:`ultraplot.figure.Figure.add_subplot` +# command (or its shorthand :func:`ultraplot.figure.Figure.subplot`). # -# * With no arguments, `~ultraplot.figure.Figure.add_subplot` returns a subplot -# generated from a 1-row, 1-column `~ultraplot.gridspec.GridSpec`. -# * With integer arguments, `~ultraplot.figure.Figure.add_subplot` returns -# a subplot matching the corresponding `~ultraplot.gridspec.GridSpec` geometry, +# * With no arguments, :func:`~ultraplot.figure.Figure.add_subplot` returns a subplot +# generated from a 1-row, 1-column :class:`~ultraplot.gridspec.GridSpec`. +# * With integer arguments, :func:`~ultraplot.figure.Figure.add_subplot` returns +# a subplot matching the corresponding :class:`~ultraplot.gridspec.GridSpec` geometry, # as in matplotlib. Note that unlike matplotlib, the geometry must be compatible -# with the geometry implied by previous `~ultraplot.figure.Figure.add_subplot` calls. -# * With a `~matplotlib.gridspec.SubplotSpec` generated by indexing a -# `ultraplot.gridspec.GridSpec`, `~ultraplot.figure.Figure.add_subplot` returns a +# with the geometry implied by previous :func:`~ultraplot.figure.Figure.add_subplot` calls. +# * With a :class:`~matplotlib.gridspec.SubplotSpec` generated by indexing a +# :class:`ultraplot.gridspec.GridSpec`, :func:`~ultraplot.figure.Figure.add_subplot` returns a # subplot at the corresponding location. Note that unlike matplotlib, only -# one `~ultraplot.figure.Figure.gridspec` can be used with each figure. +# one :func:`~ultraplot.figure.Figure.gridspec` can be used with each figure. # -# As in matplotlib, to save figures, use `~matplotlib.figure.Figure.savefig` (or its -# shorthand `ultraplot.figure.Figure.save`). User paths in the filename are expanded -# with `os.path.expanduser`. In the following examples, we add subplots to figures +# As in matplotlib, to save figures, use :func:`~matplotlib.figure.Figure.savefig` (or its +# shorthand :func:`~ultraplot.figure.Figure.save`). User paths in the filename are expanded +# with :func:`~os.path.expanduser`. In the following examples, we add subplots to figures # with a variety of methods and then save the results to the home directory. # # .. warning:: # -# ultraplot employs :ref:`automatic axis sharing ` by default. This lets +# UltraPlot employs :ref:`automatic axis sharing ` by default. This lets # subplots in the same row or column share the same axis limits, scales, ticks, # and labels. This is often convenient, but may be annoying for some users. To # keep this feature turned off, simply :ref:`change the default settings ` @@ -231,41 +231,41 @@ # Multiple subplots # ----------------- # -# If you create subplots all-at-once with e.g. `~ultraplot.ui.subplots`, -# ultraplot returns a `~ultraplot.gridspec.SubplotGrid` of subplots. This list-like, +# If you create subplots all-at-once with e.g. :func:`~ultraplot.ui.subplots`, +# UltraPlot returns a :class:`~ultraplot.gridspec.SubplotGrid` of subplots. This list-like, # array-like object provides some useful features and unifies the behavior of the # three possible return types used by `matplotlib.pyplot.subplots`: # -# * `~ultraplot.gridspec.SubplotGrid` behaves like a scalar when it is singleton. +# * :class:`~ultraplot.gridspec.SubplotGrid` behaves like a scalar when it is singleton. # In other words, if you make a single subplot with ``fig, axs = uplt.subplots()``, # then ``axs[0].method(...)`` is equivalent to ``axs.method(...)``. -# * `~ultraplot.gridspec.SubplotGrid` permits list-like 1D indexing, e.g. ``axs[1]`` +# * :class:`~ultraplot.gridspec.SubplotGrid` permits list-like 1D indexing, e.g. ``axs[1]`` # to return the second subplot. The subplots in the grid are sorted by -# `~ultraplot.axes.Axes.number` (see :ref:`this page ` for details -# on changing the `~ultraplot.axes.Axes.number` order). -# * `~ultraplot.gridspec.SubplotGrid` permits array-like 2D indexing, e.g. +# :func:`~ultraplot.axes.Axes.number` (see :ref:`this page ` for details +# on changing the :func:`~ultraplot.axes.Axes.number` order). +# * :class:`~ultraplot.gridspec.SubplotGrid` permits array-like 2D indexing, e.g. # ``axs[1, 0]`` to return the subplot in the second row, first column, or -# ``axs[:, 0]`` to return a `~ultraplot.gridspec.SubplotGrid` of every subplot +# ``axs[:, 0]`` to return a :class:`~ultraplot.gridspec.SubplotGrid` of every subplot # in the first column. The 2D indexing is powered by the underlying -# `~ultraplot.gridspec.SubplotGrid.gridspec`. +# :func:`~ultraplot.gridspec.SubplotGrid.gridspec`. # -# `~ultraplot.gridspec.SubplotGrid` includes methods for working +# :class:`~ultraplot.gridspec.SubplotGrid` includes methods for working # simultaneously with different subplots. Currently, this includes -# the commands `~ultraplot.gridspec.SubplotGrid.format`, -# `~ultraplot.gridspec.SubplotGrid.panel_axes`, -# `~ultraplot.gridspec.SubplotGrid.inset_axes`, -# `~ultraplot.gridspec.SubplotGrid.altx`, and `~ultraplot.gridspec.SubplotGrid.alty`. +# the commands :func:`~ultraplot.gridspec.SubplotGrid.format`, +# :func:`~ultraplot.gridspec.SubplotGrid.panel_axes`, +# :func:`~ultraplot.gridspec.SubplotGrid.inset_axes`, +# :func:`~ultraplot.gridspec.SubplotGrid.altx`, and :func:`~ultraplot.gridspec.SubplotGrid.alty`. # In the below example, we use `ultraplot.gridspec.SubplotGrid.format` on the grid -# returned by `~ultraplot.ui.subplots` to format different subgroups of subplots +# returned by :func:`~ultraplot.ui.subplots` to format different subgroups of subplots # (:ref:`see below ` for more on the format command). # # .. note:: # -# If you create subplots one-by-one with `~ultraplot.figure.Figure.subplot` or -# `~ultraplot.figure.Figure.add_subplot`, a `~ultraplot.gridspec.SubplotGrid` +# If you create subplots one-by-one with :func:`~ultraplot.figure.Figure.subplot` or +# :func:`~ultraplot.figure.Figure.add_subplot`, a :class:`~ultraplot.gridspec.SubplotGrid` # containing the numbered subplots is available via the -# `ultraplot.figure.Figure.subplotgrid` property. As with subplots made -# all-at-once, the subplots in the grid are sorted by `~ultraplot.axes.Axes.number`. +# :class:`ultraplot.figure.Figure.subplotgrid` property. As with subplots made +# all-at-once, the subplots in the grid are sorted by :func:`~ultraplot.axes.Axes.number`. # %% import ultraplot as uplt @@ -305,27 +305,27 @@ # Matplotlib includes `two different interfaces # `__ for plotting stuff: # a python-style object-oriented interface with axes-level commands -# like `matplotlib.axes.Axes.plot`, and a MATLAB-style `~matplotlib.pyplot` interface -# with global commands like `matplotlib.pyplot.plot` that track the "current" axes. -# ultraplot builds upon the python-style interface using the `ultraplot.axes.PlotAxes` -# class. Since every axes used by ultraplot is a child of `~ultraplot.axes.PlotAxes`, we +# like :func:`matplotlib.axes.Axes.plot`, and a MATLAB-style :func:`~matplotlib.pyplot` interface +# with global commands like :func:`matplotlib.pyplot.plot` that track the "current" axes. +# UltraPlot builds upon the python-style interface using the `ultraplot.axes.PlotAxes` +# class. Since every axes used by UltraPlot is a child of :class:`~ultraplot.axes.PlotAxes`, we # are able to add features directly to the axes-level commands rather than relying # on a separate library of commands (note that while some of these features may be -# accessible via `~matplotlib.pyplot` commands, this is not officially supported). +# accessible via :func:`~matplotlib.pyplot` commands, this is not officially supported). # -# For the most part, the features added by `~ultraplot.axes.PlotAxes` represent +# For the most part, the features added by :class:`~ultraplot.axes.PlotAxes` represent # a *superset* of matplotlib. If you are not interested, you can use the plotting # commands just like you would in matplotlib. Some of the core added features include # more flexible treatment of :ref:`data arguments `, recognition of # :ref:`xarray and pandas ` data structures, integration with -# ultraplot's :ref:`colormap ` and :ref:`color cycle ` +# UltraPlot's :ref:`colormap ` and :ref:`color cycle ` # tools, and on-the-fly :ref:`legend and colorbar generation `. # In the below example, we create a 4-panel figure with the -# familiar "1D" plotting commands `~ultraplot.axes.PlotAxes.plot` and -# `~ultraplot.axes.PlotAxes.scatter`, along with the "2D" plotting commands -# `~ultraplot.axes.PlotAxes.pcolormesh` and `~ultraplot.axes.PlotAxes.contourf`. +# familiar "1D" plotting commands :func:`~ultraplot.axes.PlotAxes.plot` and +# :func:`~ultraplot.axes.PlotAxes.scatter`, along with the "2D" plotting commands +# :func:`~ultraplot.axes.PlotAxes.pcolormesh` and :func:`~ultraplot.axes.PlotAxes.contourf`. # See the :ref:`1D plotting ` and :ref:`2D plotting ` -# sections for details on the features added by ultraplot. +# sections for details on the features added by UltraPlot. # %% @@ -368,14 +368,14 @@ # that tracks current axes and provides global commands like # `matplotlib.pyplot.title`. # -# ultraplot provides the ``format`` command as an +# UltraPlot provides the ``format`` command as an # alternative "python-style" command for formatting a variety of plot elements. # While matplotlib's one-liner commands still work, ``format`` only needs to be # called once and tends to cut down on boilerplate code. You can call # ``format`` manually or pass ``format`` parameters to axes-creation commands -# like `~ultraplot.figure.Figure.subplots`, `~ultraplot.figure.Figure.add_subplot`, -# `~ultraplot.axes.Axes.inset_axes`, `~ultraplot.axes.Axes.panel_axes`, and -# `~ultraplot.axes.CartesianAxes.altx` or `~ultraplot.axes.CartesianAxes.alty`. The +# like :func:`~ultraplot.figure.Figure.subplots`, :func:`~ultraplot.figure.Figure.add_subplot`, +# :func:`~ultraplot.axes.Axes.inset_axes`, :func:`~ultraplot.axes.Axes.panel_axes`, and +# :func:`~ultraplot.axes.CartesianAxes.altx` or :func:`~ultraplot.axes.CartesianAxes.alty`. The # keyword arguments accepted by ``format`` can be grouped as follows: # # * Figure settings. These are related to row labels, column labels, and @@ -389,10 +389,10 @@ # * Cartesian axes settings (valid only for `~ultraplot.axes.CartesianAxes`). # These are related to *x* and *y* axis ticks, spines, bounds, and labels -- # for example, ``ax.format(xlim=(0, 5))`` changes the x axis bounds. -# See `ultraplot.axes.CartesianAxes.format` and +# See :func:`ultraplot.axes.CartesianAxes.format` and # :ref:`this section ` for details. # -# * Polar axes settings (valid only for `~ultraplot.axes.PolarAxes`). +# * Polar axes settings (valid only for :class:`~ultraplot.axes.PolarAxes`). # These are related to azimuthal and radial grid lines, bounds, and labels -- # for example, ``ax.format(rlim=(0, 10))`` changes the radial bounds. # See `ultraplot.axes.PolarAxes.format` @@ -404,7 +404,7 @@ # changes the meridional bounds. See `ultraplot.axes.GeoAxes.format` # and :ref:`this section ` for details. # -# * `~ultraplot.config.rc` settings. Any keyword matching the name +# * :func:`~ultraplot.config.rc` settings. Any keyword matching the name # of an rc setting is locally applied to the figure and axes. # If the name has "dots", you can pass it as a keyword argument with # the "dots" omitted, or pass it to `rc_kw` in a dictionary. For example, the @@ -470,24 +470,24 @@ # Settings and styles # ------------------- # -# A dictionary-like object named `~ultraplot.config.rc` is created when you import -# ultraplot. `~ultraplot.config.rc` is similar to the matplotlib `~matplotlib.rcParams` +# A dictionary-like object named :func:`~ultraplot.config.rc` is created when you import +# UltraPlot. :func:`~ultraplot.config.rc` is similar to the matplotlib `~matplotlib.rcParams` # dictionary, but can be used to change both `matplotlib settings # `__ and -# :ref:`ultraplot settings `. The matplotlib-specific settings are -# stored in `~ultraplot.config.rc_matplotlib` (our name for `matplotlib.rcParams`) and -# the ultraplot-specific settings are stored in `~ultraplot.config.rc_ultraplot`. -# ultraplot also includes a :rcraw:`style` setting that can be used to +# :ref:`ultraplot settings `. The matplotlib-specific settings are +# stored in :func:`~ultraplot.config.rc_matplotlib` (our name for `matplotlib.rcParams`) and +# the UltraPlot-specific settings are stored in `~ultraplot.config.rc_UltraPlot`. +# UltraPlot also includes a :rcraw:`style` setting that can be used to # switch between `matplotlib stylesheets # `__. # See the :ref:`configuration section ` for details. # # To modify a setting for just one subplot or figure, you can pass it to # `ultraplot.axes.Axes.format` or `ultraplot.figure.Figure.format`. To temporarily -# modify setting(s) for a block of code, use `~ultraplot.config.Configurator.context`. +# modify setting(s) for a block of code, use :func:`~ultraplot.config.Configurator.context`. # To modify setting(s) for the entire python session, just assign it to the -# `~ultraplot.config.rc` dictionary or use `~ultraplot.config.Configurator.update`. -# To reset everything to the default state, use `~ultraplot.config.Configurator.reset`. +# :func:`~ultraplot.config.rc` dictionary or use :func:`~ultraplot.config.Configurator.update`. +# To reset everything to the default state, use :func:`~ultraplot.config.Configurator.reset`. # See the below example. diff --git a/docs/cartesian.py b/docs/cartesian.py index cc2223612..afd91c7f2 100644 --- a/docs/cartesian.py +++ b/docs/cartesian.py @@ -32,23 +32,23 @@ # # Matplotlib `tick locators # `__ -# select sensible tick locations based on the axis data limits. In ultraplot, you can -# change the tick locator using the `~ultraplot.axes.CartesianAxes.format` keyword +# select sensible tick locations based on the axis data limits. In UltraPlot, you can +# change the tick locator using the :func:`~ultraplot.axes.CartesianAxes.format` keyword # arguments `xlocator`, `ylocator`, `xminorlocator`, and `yminorlocator` (or their # aliases, `xticks`, `yticks`, `xminorticks`, and `yminorticks`). This is powered by -# the `~ultraplot.constructor.Locator` :ref:`constructor function `. +# the :class:`~ultraplot.constructor.Locator` :ref:`constructor function `. # # You can use these keyword arguments to apply built-in matplotlib -# `~matplotlib.ticker.Locator`\ s by their "registered" names +# :class:`~matplotlib.ticker.Locator`\ s by their "registered" names # (e.g., ``xlocator='log'``), to draw ticks every ``N`` data values with -# `~matplotlib.ticker.MultipleLocator` (e.g., ``xlocator=2``), or to tick the -# specific locations in a list using `~matplotlib.ticker.FixedLocator` (just -# like `~matplotlib.axes.Axes.set_xticks` and `~matplotlib.axes.Axes.set_yticks`). +# :class:`~matplotlib.ticker.MultipleLocator` (e.g., ``xlocator=2``), or to tick the +# specific locations in a list using :class:`~matplotlib.ticker.FixedLocator` (just +# like :func:`~matplotlib.axes.Axes.set_xticks` and :func:`~matplotlib.axes.Axes.set_yticks`). # If you want to work with the locator classes directly, they are available in the # top-level namespace (e.g., ``xlocator=uplt.MultipleLocator(...)`` is allowed). # -# To generate lists of tick locations, we recommend using ultraplot's -# `~ultraplot.utils.arange` function -- it’s basically an endpoint-inclusive +# To generate lists of tick locations, we recommend using UltraPlot's +# :func:`~ultraplot.utils.arange` function -- it’s basically an endpoint-inclusive # version of `numpy.arange`, which is usually what you'll want in this context. # %% @@ -107,18 +107,18 @@ # # Matplotlib `tick formatters # `__ -# convert floating point numbers to nicely-formatted tick labels. In ultraplot, you can -# change the tick formatter using the `~ultraplot.axes.CartesianAxes.format` keyword +# convert floating point numbers to nicely-formatted tick labels. In UltraPlot, you can +# change the tick formatter using the :func:`~ultraplot.axes.CartesianAxes.format` keyword # arguments `xformatter` and `yformatter` (or their aliases, `xticklabels` and -# `yticklabels`). This is powered by the `~ultraplot.constructor.Formatter` +# `yticklabels`). This is powered by the :class:`~ultraplot.constructor.Formatter` # :ref:`constructor function `. # # You can use these keyword arguments to apply built-in matplotlib -# `~matplotlib.ticker.Formatter`\ s by their "registered" names +# :class:`~matplotlib.ticker.Formatter`\ s by their "registered" names # (e.g., ``xformatter='log'``), to apply a ``%``-style format directive with # `~matplotlib.ticker.FormatStrFormatter` (e.g., ``xformatter='%.0f'``), or # to apply custom tick labels with `~matplotlib.ticker.FixedFormatter` (just -# like `~matplotlib.axes.Axes.set_xticklabels`). You can also apply one of ultraplot's +# like :func:`~matplotlib.axes.Axes.set_xticklabels`). You can also apply one of UltraPlot's # new tick formatters -- for example, ``xformatter='deglat'`` to label ticks # as geographic latitude coordinates, ``xformatter='pi'`` to label ticks as # fractions of :math:`\pi`, or ``xformatter='sci'`` to label ticks with @@ -126,11 +126,11 @@ # directly, they are available in the top-level namespace # (e.g., ``xformatter=uplt.SciFormatter(...)`` is allowed). # -# ultraplot also changes the default tick formatter to -# `~ultraplot.ticker.AutoFormatter`. This class trims trailing zeros by +# UltraPlot also changes the default tick formatter to +# :class:`~ultraplot.ticker.AutoFormatter`. This class trims trailing zeros by # default, can optionally omit or wrap tick values within particular # number ranges, and can add prefixes and suffixes to each label. See -# `~ultraplot.ticker.AutoFormatter` for details. To disable the trailing +# :class:`~ultraplot.ticker.AutoFormatter` for details. To disable the trailing # zero-trimming feature, set :rcraw:`formatter.zerotrim` to ``False``. # %% @@ -152,7 +152,7 @@ # Formatter comparison locator = [0, 0.25, 0.5, 0.75, 1] axs[0].format(xformatter="scalar", yformatter="scalar", title="Matplotlib formatter") -axs[1].format(title="ultraplot formatter") +axs[1].format(title="UltraPlot formatter") axs[:2].format(xlocator=locator, ylocator=locator) # Limiting the tick range @@ -248,17 +248,17 @@ # -------------- # # The above examples all assumed typical "numeric" axes. However -# `~ultraplot.axes.CartesianAxes.format` can also modify the tick locations and tick +# :func:`~ultraplot.axes.CartesianAxes.format` can also modify the tick locations and tick # labels for "datetime" axes. To draw ticks on each occurence of some particular time # unit, use a unit string (e.g., ``xlocator='month'``). To draw ticks every ``N`` time # units, use a (unit, N) tuple (e.g., ``xlocator=('day', 5)``). For `% style formatting # `__ -# of datetime tick labels with `~datetime.datetime.strftime`, you can use a string +# of datetime tick labels with :func:`~datetime.datetime.strftime`, you can use a string # containing ``'%'`` (e.g. ``xformatter='%Y-%m-%d'``). By default, *x* axis datetime # axis labels are rotated 90 degrees, like in `pandas`_. This can be disabled by -# passing ``xrotation=0`` to `~ultraplot.axes.CartesianAxes.format` or by setting -# :rcraw:`formatter.timerotation` to ``0``. See `~ultraplot.constructor.Locator` -# and `~ultraplot.constructor.Formatter` for details. +# passing ``xrotation=0`` to :func:`~ultraplot.axes.CartesianAxes.format` or by setting +# :rcraw:`formatter.timerotation` to ``0``. See :class:`~ultraplot.constructor.Locator` +# and :class:`~ultraplot.constructor.Formatter` for details. # %% import ultraplot as uplt @@ -333,17 +333,17 @@ # The locations of `axis spines # `__, # tick marks, tick labels, and axis labels can be controlled with -# `ultraplot.axes.CartesianAxes.format` keyword arguments like `xspineloc` +# :func:`ultraplot.axes.CartesianAxes.format` keyword arguments like `xspineloc` # (shorthand `xloc`), `xtickloc`, `xticklabelloc`, and `xlabelloc`. Valid # locations include ``'left'``, ``'right'``, ``'top'``, ``'bottom'``, ``'neither'``, # ``'none'``, or ``'both'``. Spine locations can also be set to a valid -# `~matplotlib.spines.Spine.set_position` value, e.g. ``'zero'`` or +# :func:`~matplotlib.spines.Spine.set_position` value, e.g. ``'zero'`` or # ``('axes', 1.5)``. The top or right spine is used when the coordinate is # more than halfway across the axes. This is often convenient when passing # e.g. `loc` to :ref:`"alternate" axes commands `. These keywords -# provide the functionality of matplotlib's `~matplotlib.axis.YAxis.tick_left`, -# `~matplotlib.axis.YAxis.tick_right`, `~matplotlib.axis.XAxis.tick_top`, and -# `~matplotlib.axis.XAxis.tick_bottom`, and `~matplotlib.spines.Spine.set_position`, +# provide the functionality of matplotlib's :func:`~matplotlib.axis.YAxis.tick_left`, +# :func:`~matplotlib.axis.YAxis.tick_right`, :func:`~matplotlib.axis.XAxis.tick_top`, and +# :func:`~matplotlib.axis.XAxis.tick_bottom`, and :func:`~matplotlib.spines.Spine.set_position`, # but with additional flexibility. # %% @@ -382,30 +382,30 @@ # # "Axis scales" like ``'linear'`` and ``'log'`` control the *x* and *y* axis # coordinate system. To change the axis scale, pass e.g. ``xscale='log'`` or -# ``yscale='log'`` to `~ultraplot.axes.Axes.format`. This is powered by the -# `~ultraplot.constructor.Scale` :ref:`constructor function `. -# ultraplot makes several changes to the axis scale API: +# ``yscale='log'`` to :func:`~ultraplot.axes.Axes.format`. This is powered by the +# :class:`~ultraplot.constructor.Scale` :ref:`constructor function `. +# UltraPlot makes several changes to the axis scale API: # -# * The `~ultraplot.ticker.AutoFormatter` formatter is now used for all axis scales +# * The :class:`~ultraplot.ticker.AutoFormatter` formatter is now used for all axis scales # by default, including ``'log'`` and ``'symlog'``. Matplotlib's behavior can # be restored by passing e.g. ``xformatter='log'`` or ``yformatter='log'`` to -# `~ultraplot.axes.CartesianAxes.format`. -# * To make its behavior consistent with `~ultraplot.constructor.Locator` and -# `~ultraplot.constructor.Formatter`, the `~ultraplot.constructor.Scale` +# :func:`~ultraplot.axes.CartesianAxes.format`. +# * To make its behavior consistent with :class:`~ultraplot.constructor.Locator` and +# :class:`~ultraplot.constructor.Formatter`, the :class:`~ultraplot.constructor.Scale` # constructor function returns instances of `~matplotlib.scale.ScaleBase`, -# and `~matplotlib.axes.Axes.set_xscale` and -# `~matplotlib.axes.Axes.set_yscale` now accept these class instances in +# and :func:`~matplotlib.axes.Axes.set_xscale` and +# :func:`~matplotlib.axes.Axes.set_yscale` now accept these class instances in # addition to "registered" names like ``'log'``. # * While matplotlib axis scales must be instantiated with an -# `~matplotlib.axis.Axis` instance (for backwards compatibility reasons), -# ultraplot axis scales can be instantiated without the axis instance +# :class:`~matplotlib.axis.Axis` instance (for backwards compatibility reasons), +# UltraPlot axis scales can be instantiated without the axis instance # (e.g., ``uplt.LogScale()`` instead of ``uplt.LogScale(ax.xaxis)``). # * The default `subs` for the ``'symlog'`` axis scale is now ``np.arange(1, 10)``, # and the default `linthresh` is now ``1``. Also the ``'log'`` and ``'symlog'`` # axis scales now accept the keywords `base`, `linthresh`, `linscale`, and # `subs` rather than keywords with trailing ``x`` or ``y``. # -# ultraplot also includes a few new axis scales. The ``'cutoff'`` scale +# UltraPlot also includes a few new axis scales. The ``'cutoff'`` scale # `~ultraplot.scale.CutoffScale` is useful when the statistical distribution # of your data is very unusual. The ``'sine'`` scale `~ultraplot.scale.SineLatitudeScale` # scales the axis with a sine function (resulting in an area-weighted spherical latitude @@ -545,16 +545,16 @@ # Alternate axes # -------------- # -# The `matplotlib.axes.Axes` class includes `~matplotlib.axes.Axes.twinx` -# and `~matplotlib.axes.Axes.twiny` commands for drawing "twin" *x* and -# *y* axes in the same subplot. ultraplot expands on these commands and adds -# the arguably more intuitive `~ultraplot.axes.CartesianAxes.altx` and -# `~ultraplot.axes.CartesianAxes.alty` options. Here `~ultraplot.axes.CartesianAxes.altx` -# is equivalent to `~ultraplot.axes.CartesianAxes.twiny` (makes an alternate *x* -# axes and an identical twin *y* axes) and `~ultraplot.axes.CartesianAxes.alty` -# is equivalent to `~ultraplot.axes.CartesianAxes.twinx` (makes an alternate *y* -# axes and an identical twin *x* axes). The ultraplot versions can be quickly -# formatted by passing `ultraplot.axes.CartesianAxes.format` keyword arguments +# The `matplotlib.axes.Axes` class includes :func:`~matplotlib.axes.Axes.twinx` +# and :func:`~matplotlib.axes.Axes.twiny` commands for drawing "twin" *x* and +# *y* axes in the same subplot. UltraPlot expands on these commands and adds +# the arguably more intuitive :func:`~ultraplot.axes.CartesianAxes.altx` and +# :func:`~ultraplot.axes.CartesianAxes.alty` options. Here :func:`~ultraplot.axes.CartesianAxes.altx` +# is equivalent to :func:`~ultraplot.axes.CartesianAxes.twiny` (makes an alternate *x* +# axes and an identical twin *y* axes) and :func:`~ultraplot.axes.CartesianAxes.alty` +# is equivalent to :func:`~ultraplot.axes.CartesianAxes.twinx` (makes an alternate *y* +# axes and an identical twin *x* axes). The UltraPlot versions can be quickly +# formatted by passing :func:`ultraplot.axes.CartesianAxes.format` keyword arguments # to the commands (e.g., ``ax.alty(ycolor='red')`` or, since the ``y`` prefix in # this context is redundant, just ``ax.alty(color='red')``). They also enforce # sensible default locations for the spines, ticks, and labels, and disable @@ -562,13 +562,13 @@ # # .. note:: # -# Unlike matplotlib, ultraplot adds alternate axes as `children +# Unlike matplotlib, UltraPlot adds alternate axes as `children # `__ # of the original axes. This helps simplify the :ref:`tight layout algorithm # ` but means that the drawing order is controlled by the difference # between the zorders of the alternate axes and the content *inside* the original # axes rather than the zorder of the original axes itself (see `this issue page -# `__ for details). +# `__ for details). # %% import ultraplot as uplt @@ -604,13 +604,13 @@ # Dual unit axes # -------------- # -# The `~ultraplot.axes.CartesianAxes.dualx` and -# `~ultraplot.axes.CartesianAxes.dualy` methods can be used to draw duplicate *x* and +# The :func:`~ultraplot.axes.CartesianAxes.dualx` and +# :func:`~ultraplot.axes.CartesianAxes.dualy` methods can be used to draw duplicate *x* and # *y* axes meant to represent *alternate units* in the same coordinate range as the -# "parent" axis. This feature is powered by the `~ultraplot.scale.FuncScale` class. -# `~ultraplot.axes.CartesianAxes.dualx` and `~ultraplot.axes.CartesianAxes.dualy` accept -# the same axis formatting keyword arguments as `~ultraplot.axes.CartesianAxes.altx` -# and `~ultraplot.axes.CartesianAxes.alty`. The alternate units are specified with +# "parent" axis. This feature is powered by the :class:`~ultraplot.scale.FuncScale` class. +# :func:`~ultraplot.axes.CartesianAxes.dualx` and :func:`~ultraplot.axes.CartesianAxes.dualy` accept +# the same axis formatting keyword arguments as :func:`~ultraplot.axes.CartesianAxes.altx` +# and :func:`~ultraplot.axes.CartesianAxes.alty`. The alternate units are specified with # either of the following three positional arguments: # # #. A single linear forward function. @@ -622,7 +622,7 @@ # for the default dual axis locators and formatters. In the below examples, # we generate dual axes with each of these three methods. Note that the # "parent" axis scale is arbitrary -- in the first example, we create -# a `~ultraplot.axes.CartesianAxes.dualx` axis for a `symlog-scaled +# a :func:`~ultraplot.axes.CartesianAxes.dualx` axis for a `symlog-scaled # `__ axis. # %% diff --git a/docs/colorbars_legends.py b/docs/colorbars_legends.py index 5e8ee03ae..652972433 100644 --- a/docs/colorbars_legends.py +++ b/docs/colorbars_legends.py @@ -18,7 +18,7 @@ # Colorbars and legends # ===================== # -# ultraplot includes some useful changes to the matplotlib API that make +# UltraPlot includes some useful changes to the matplotlib API that make # working with colorbars and legends :ref:`easier `. # Notable features include "inset" colorbars, "outer" legends, # on-the-fly colorbars and legends, colorbars built from artists, @@ -36,7 +36,7 @@ # posssible using the somewhat opaque `bbox_to_anchor` keyword (see `here # `__) # and "inset" colorbars are not possible without manually creating and positioning -# the associated axes. ultraplot tries to improve this behavior: +# the associated axes. UltraPlot tries to improve this behavior: # # * `ultraplot.axes.Axes.legend` can draw both "inset" legends when you request an inset # location (e.g., ``loc='upper right'`` or the shorthand ``loc='ur'``) and "outer" @@ -45,17 +45,17 @@ # or colorbars on one side, they are "stacked" on top of each other. Unlike using # `bbox_to_anchor`, the "outer" legend position is adjusted automatically when the # :ref:`tight layout algorithm ` is active. -# * ultraplot adds the axes command `ultraplot.axes.Axes.colorbar`, +# * UltraPlot adds the axes command `ultraplot.axes.Axes.colorbar`, # analogous to `ultraplot.axes.Axes.legend` and equivalent to # calling `ultraplot.figure.Figure.colorbar` with an `ax` keyword. -# `~ultraplot.axes.Axes.colorbar` can draw both "outer" colorbars when you request +# :func:`~ultraplot.axes.Axes.colorbar` can draw both "outer" colorbars when you request # a side location (e.g., ``loc='right'`` or the shorthand ``loc='r'``) and "inset" # colorbars when you request an :ref:`inset location ` # (e.g., ``loc='upper right'`` or the shorthand ``loc='ur'``). Inset # colorbars have optional background "frames" that can be configured -# with various `~ultraplot.axes.Axes.colorbar` keywords. +# with various :func:`~ultraplot.axes.Axes.colorbar` keywords. -# `~ultraplot.axes.Axes.colorbar` and `~ultraplot.axes.Axes.legend` also both accept +# :func:`~ultraplot.axes.Axes.colorbar` and :func::class:`~ultraplot.axes.Axes.legend` also both accept # `space` and `pad` keywords. `space` controls the absolute separation of the # "outer" colorbar or legend from the parent subplot edge and `pad` controls the # :ref:`tight layout ` padding relative to the subplot's tick and axis labels @@ -65,14 +65,14 @@ # # .. important:: # -# Unlike matplotlib, ultraplot adds "outer" colorbars and legends by allocating -# new rows and columns in the `~ultraplot.gridspec.GridSpec` rather than +# Unlike matplotlib, UltraPlot adds "outer" colorbars and legends by allocating +# new rows and columns in the :class:`~ultraplot.gridspec.GridSpec` rather than # "stealing" space from the parent subplot (note that subsequently indexing -# the `~ultraplot.gridspec.GridSpec` will ignore the slots allocated for +# the :class:`~ultraplot.gridspec.GridSpec` will ignore the slots allocated for # colorbars and legends). This approach means that "outer" colorbars and # legends :ref:`do not affect subplot aspect ratios ` # and :ref:`do not affect subplot spacing `, which lets -# ultraplot avoid relying on complicated `"constrained layout" algorithms +# UltraPlot avoid relying on complicated `"constrained layout" algorithms # `__ # and tends to improve the appearance of figures with even the most # complex arrangements of subplots, colorbars, and legends. @@ -112,15 +112,15 @@ # On-the-fly colorbars and legends # -------------------------------- # -# In ultraplot, you can add colorbars and legends on-the-fly by supplying keyword -# arguments to various `~ultraplot.axes.PlotAxes` commands. To plot data and +# In UltraPlot, you can add colorbars and legends on-the-fly by supplying keyword +# arguments to various :class:`~ultraplot.axes.PlotAxes` commands. To plot data and # draw a colorbar or legend in one go, pass a location (e.g., ``colorbar='r'`` -# or ``legend='b'``) to the plotting command (e.g., `~ultraplot.axes.PlotAxes.plot` -# or `~ultraplot.axes.PlotAxes.contour`). To pass keyword arguments to the colorbar +# or ``legend='b'``) to the plotting command (e.g., :func:`~ultraplot.axes.PlotAxes.plot` +# or :func:`~ultraplot.axes.PlotAxes.contour`). To pass keyword arguments to the colorbar # and legend commands, use the `legend_kw` and `colorbar_kw` arguments (e.g., -# ``legend_kw={'ncol': 3}``). Note that `~ultraplot.axes.Axes.colorbar` can also +# ``legend_kw={'ncol': 3}``). Note that :func:`~ultraplot.axes.Axes.colorbar` can also # build colorbars from lists of arbitrary matplotlib artists, for example the -# lines generated by `~ultraplot.axes.PlotAxes.plot` or `~ultraplot.axes.PlotAxes.line` +# lines generated by :func:`~ultraplot.axes.PlotAxes.plot` or :func:`~ultraplot.axes.PlotAxes.line` # (see :ref:`below `). # # .. note:: @@ -217,10 +217,10 @@ # Figure-wide colorbars and legends # --------------------------------- # -# In ultraplot, colorbars and legends can be added to the edge of figures using the -# figure methods `ultraplot.figure.Figure.colorbar` and `ultraplot.figure.Figure.legend`. +# In UltraPlot, colorbars and legends can be added to the edge of figures using the +# figure methods `ultraplot.figure.Figure.colorbar` and :class:`ultraplot.figure.Figure.legend`. # These methods align colorbars and legends between the edges -# of the `~ultraplot.figure.Figure.gridspec` rather than the figure. +# of the :func:`~ultraplot.figure.Figure.gridspec` rather than the figure. # As with :ref:`axes colorbars and legends `, if you # draw multiple colorbars or legends on the same side, they are stacked on # top of each other. To draw a colorbar or legend alongside particular row(s) or @@ -293,31 +293,31 @@ # # The `ultraplot.axes.Axes.colorbar` and `ultraplot.figure.Figure.colorbar` commands are # somehwat more flexible than their matplotlib counterparts. The following core -# features are unique to ultraplot: +# features are unique to UltraPlot: -# * Calling ``colorbar`` with a list of `~matplotlib.artist.Artist`\ s, -# a `~matplotlib.colors.Colormap` name or object, or a list of colors +# * Calling ``colorbar`` with a list of :class:`~matplotlib.artist.Artist`\ s, +# a :class:`~matplotlib.colors.Colormap` name or object, or a list of colors # will build the required `~matplotlib.cm.ScalarMappable` on-the-fly. Lists -# of `~matplotlib.artist.Artists`\ s are used when you use the `colorbar` -# keyword with :ref:`1D commands ` like `~ultraplot.axes.PlotAxes.plot`. +# of :class:`~matplotlib.artist.Artists`\ s are used when you use the `colorbar` +# keyword with :ref:`1D commands ` like :func:`~ultraplot.axes.PlotAxes.plot`. # * The associated :ref:`colormap normalizer ` can be specified with the # `vmin`, `vmax`, `norm`, and `norm_kw` keywords. The `~ultraplot.colors.DiscreteNorm` -# levels can be specified with `values`, or ultraplot will infer them from the -# `~matplotlib.artist.Artist` labels (non-numeric labels will be applied to +# levels can be specified with `values`, or UltraPlot will infer them from the +# :class:`~matplotlib.artist.Artist` labels (non-numeric labels will be applied to # the colorbar as tick labels). This can be useful for labeling discrete plot # elements that bear some numeric relationship to each other. # -# ultraplot also includes improvements for adding ticks and tick labels to colorbars. -# Similar to `ultraplot.axes.CartesianAxes.format`, you can flexibly specify +# UltraPlot also includes improvements for adding ticks and tick labels to colorbars. +# Similar to :func:`ultraplot.axes.CartesianAxes.format`, you can flexibly specify # major tick locations, minor tick locations, and major tick labels using the # `locator`, `minorlocator`, `formatter`, `ticks`, `minorticks`, and `ticklabels` -# keywords. These arguments are passed through the `~ultraplot.constructor.Locator` and -# `~ultraplot.constructor.Formatter` :ref:`constructor functions `. +# keywords. These arguments are passed through the :class:`~ultraplot.constructor.Locator` and +# :class:`~ultraplot.constructor.Formatter` :ref:`constructor functions `. # Unlike matplotlib, the default ticks for :ref:`discrete colormaps ` # are restricted based on the axis length using `~ultraplot.ticker.DiscreteLocator`. # You can easily toggle minor ticks using ``tickminor=True``. # -# Similar to :ref:`axes panels `, the geometry of ultraplot colorbars is +# Similar to :ref:`axes panels `, the geometry of UltraPlot colorbars is # specified with :ref:`physical units ` (this helps avoid the common issue # where colorbars appear "too skinny" or "too fat" and preserves their appearance # when the figure size changes). You can specify the colorbar width locally using the @@ -330,7 +330,7 @@ # than relative units using the `extendsize` keyword rather than matplotlib's # `extendfrac`. The default `extendsize` values are :rcraw:`colorbar.extend` (for # outer colorbars) and :rcraw:`colorbar.insetextend` (for inset colorbars). -# See `~ultraplot.axes.Axes.colorbar` for details. +# See :func:`~ultraplot.axes.Axes.colorbar` for details. # %% import ultraplot as uplt @@ -380,34 +380,34 @@ # Added legend features # --------------------- # -# The `ultraplot.axes.Axes.legend` and `ultraplot.figure.Figure.legend` commands are +# The `ultraplot.axes.Axes.legend` and :class:`ultraplot.figure.Figure.legend` commands are # somewhat more flexible than their matplotlib counterparts. The following core # features are the same as matplotlib: # * Calling ``legend`` without positional arguments will # automatically fill the legend with the labeled artist in the # the parent axes (when using `ultraplot.axes.Axes.legend`) or -# or the parent figure (when using `ultraplot.figure.Figure.legend`). +# or the parent figure (when using :class:`ultraplot.figure.Figure.legend`). # * Legend labels can be assigned early by calling plotting comamnds with # the `label` keyword (e.g., ``ax.plot(..., label='label')``) or on-the-fly by # passing two positional arguments to ``legend`` (where the first argument is the # "handle" list and the second is the "label" list). -# The following core features are unique to ultraplot: +# The following core features are unique to UltraPlot: # * Legend labels can be assigned for each column of a # :ref:`2D array passed to a 1D plotting command ` # using the `labels` keyword (e.g., ``labels=['label1', 'label2', ...]``). # * Legend labels can be assigned to `~matplotlib.contour.ContourSet`\ s by passing -# the `label` keyword to a contouring command (e.g., `~ultraplot.axes.PlotAxes.contour` -# or `~ultraplot.axes.PlotAxes.contourf`). +# the `label` keyword to a contouring command (e.g., :func:`~ultraplot.axes.PlotAxes.contour` +# or :func:`~ultraplot.axes.PlotAxes.contourf`). # * A "handle" list can be passed to ``legend`` as the sole # positional argument and the labels will be automatically inferred # using `~matplotlib.artist.Artist.get_label`. Valid "handles" include -# `~matplotlib.lines.Line2D`\ s returned by `~ultraplot.axes.PlotAxes.plot`, -# `~matplotlib.container.BarContainer`\ s returned by `~ultraplot.axes.PlotAxes.bar`, -# and `~matplotlib.collections.PolyCollection`\ s -# returned by `~ultraplot.axes.PlotAxes.fill_between`. +# `~matplotlib.lines.Line2D`\ s returned by :func:`~ultraplot.axes.PlotAxes.plot`, +# :class:`~matplotlib.container.BarContainer`\ s returned by :func:`~ultraplot.axes.PlotAxes.bar`, +# and :class:`~matplotlib.collections.PolyCollection`\ s +# returned by :func:`~ultraplot.axes.PlotAxes.fill_between`. # * A composite handle can be created by grouping the "handle" # list objects into tuples (see this `matplotlib guide # `__ @@ -415,7 +415,7 @@ # inferred from the objects in the group. If multiple distinct # labels are found then the group is automatically expanded. # -# `ultraplot.axes.Axes.legend` and `ultraplot.figure.Figure.legend` include a few other +# `ultraplot.axes.Axes.legend` and :class:`ultraplot.figure.Figure.legend` include a few other # useful features. To draw legends with centered rows, pass ``center=True`` or # a list of lists of "handles" to ``legend`` (this stacks several single-row, # horizontally centered legends and adds an encompassing frame behind them). @@ -423,7 +423,7 @@ # use the `order` keyword (the default ``order='C'`` is row-major, # unlike matplotlib's column-major ``order='F'``). To alphabetize the legend # entries, pass ``alphabetize=True`` to ``legend``. To modify the legend handles -# (e.g., `~ultraplot.axes.PlotAxes.plot` or `~ultraplot.axes.PlotAxes.scatter` handles) +# (e.g., :func:`~ultraplot.axes.PlotAxes.plot` or :func:`~ultraplot.axes.PlotAxes.scatter` handles) # pass the relevant properties like `color`, `linewidth`, or `markersize` to ``legend`` # (or use the `handle_kw` keyword). See `ultraplot.axes.Axes.legend` for details. diff --git a/docs/colormaps.py b/docs/colormaps.py index 759ee53c6..7d258eb68 100644 --- a/docs/colormaps.py +++ b/docs/colormaps.py @@ -31,15 +31,15 @@ # Colormaps # ========= # -# ultraplot defines **continuous colormaps** as color palettes that sample some +# UltraPlot defines **continuous colormaps** as color palettes that sample some # *continuous function* between two end colors. They are generally used # to encode data values on a pseudo-third dimension. They are implemented -# in ultraplot with the `~ultraplot.colors.ContinuousColormap` and -# `~ultraplot.colors.PerceptualColormap` classes, which are +# in UltraPlot with the :class:`~ultraplot.colors.ContinuousColormap` and +# :class:`~ultraplot.colors.PerceptualColormap` classes, which are # :ref:`subclassed from ` # `matplotlib.colors.LinearSegmentedColormap`. # -# ultraplot :ref:`adds several features ` to help you use +# UltraPlot :ref:`adds several features ` to help you use # colormaps effectively in your figures. This section documents the new registered # colormaps, explains how to make and modify colormaps, and shows how to apply them # to your plots. @@ -51,16 +51,16 @@ # Included colormaps # ------------------ # -# On import, ultraplot registers a few sample +# On import, UltraPlot registers a few sample # :ref:`perceptually uniform colormaps `, plus several # colormaps from other online data viz projects. Use `~ultraplot.demos.show_cmaps` # to generate a table of registered colormaps. The figure is broken down into # the following sections: # -# * "User" colormaps created with `~ultraplot.constructor.Colormap` -# or loaded from `~ultraplot.config.Configurator.user_folder`. +# * "User" colormaps created with :class:`~ultraplot.constructor.Colormap` +# or loaded from :func:`~ultraplot.config.Configurator.user_folder`. # * `Matplotlib `_ and `seaborn `_ original colormaps. -# * ultraplot original :ref:`perceptually uniform colormaps `. +# * UltraPlot original :ref:`perceptually uniform colormaps `. # * The `cmOcean `_ colormaps, designed for # oceanographic data but useful for everyone. # * Fabio Crameri's `"scientific colour maps" `_. @@ -77,12 +77,12 @@ # .. note:: # # Colormap and :ref:`color cycle ` identification is more flexible in -# ultraplot. The names are are case-insensitive (e.g., ``'Viridis'``, ``'viridis'``, +# UltraPlot. The names are are case-insensitive (e.g., ``'Viridis'``, ``'viridis'``, # and ``'ViRiDiS'`` are equivalent), diverging colormap names can be specified in # their "reversed" form (e.g., ``'BuRd'`` is equivalent to ``'RdBu_r'``), and # appending ``'_r'`` or ``'_s'`` to *any* colormap name will return a # `~ultraplot.colors.ContinuousColormap.reversed` or -# `~ultraplot.colors.ContinuousColormap.shifted` version of the colormap +# :property:`~ultraplot.colors.ContinuousColormap.shifted` version of the colormap # or color cycle. See `~ultraplot.colors.ColormapDatabase` for more info. # %% @@ -97,8 +97,8 @@ # Perceptually uniform colormaps # ------------------------------ # -# ultraplot's custom colormaps are instances of the -# `~ultraplot.colors.PerceptualColormap` class. These colormaps +# UltraPlot's custom colormaps are instances of the +# :class:`~ultraplot.colors.PerceptualColormap` class. These colormaps # generate colors by interpolating between coordinates in any # of the following three hue-saturation-luminance colorspaces: # @@ -117,7 +117,7 @@ # saturation *for a given hue and luminance*. HSL gives you access to the # entire RGB colorspace, but often results in sharp jumps in chroma. # -# The colorspace used by a `~ultraplot.colors.PerceptualColormap` +# The colorspace used by a :class:`~ultraplot.colors.PerceptualColormap` # is set with the `space` keyword arg. To plot arbitrary cross-sections of # these colorspaces, use `~ultraplot.demos.show_colorspaces` (the black # regions represent impossible colors). To see how colormaps vary with @@ -128,7 +128,7 @@ # and luminance (second figure, top row). In practice, this is # difficult to accomplish due to impossible colors. Matplotlib's and seaborn's # ``'magma'`` and ``'Rocket'`` colormaps are fairly linear with respect to -# hue and luminance, but not chroma. ultraplot's ``'Fire'`` is linear in hue, +# hue and luminance, but not chroma. UltraPlot's ``'Fire'`` is linear in hue, # luminance, and *HSL saturation* (bottom left), while ``'Dusk'`` is linear # in hue, luminance, and *HPL saturation* (bottom right). @@ -156,17 +156,17 @@ # Making colormaps # ---------------- # -# ultraplot includes tools for merging colormaps, modifying existing colormaps, +# UltraPlot includes tools for merging colormaps, modifying existing colormaps, # making new :ref:`perceptually uniform colormaps `, and # saving colormaps for future use. Most of these features can be accessed via the -# `~ultraplot.constructor.Colormap` :ref:`constructor function `. -# Note that every `~ultraplot.axes.PlotAxes` command that accepts a `cmap` keyword passes +# :class:`~ultraplot.constructor.Colormap` :ref:`constructor function `. +# Note that every :class:`~ultraplot.axes.PlotAxes` command that accepts a `cmap` keyword passes # it through this function (see the :ref:`2D plotting section `). # -# To make `~ultraplot.colors.PerceptualColormap`\ s from +# To make :class:`~ultraplot.colors.PerceptualColormap`\ s from # scratch, you have the following three options: # -# * Pass a color name, HEX string, or RGB tuple to `~ultraplot.constructor.Colormap`. +# * Pass a color name, HEX string, or RGB tuple to :class:`~ultraplot.constructor.Colormap`. # This builds a monochromatic (single hue) colormap by calling # `~ultraplot.colors.PerceptualColormap.from_color`. The colormap colors will # progress from the specified color to a color with the same hue but changed @@ -174,7 +174,7 @@ # keywords (or their shorthands `s` and `l`). By default, the colormap will # progress to pure white. # * Pass a list of color names, HEX strings, or RGB -# tuples to `~ultraplot.constructor.Colormap`. This calls +# tuples to :class:`~ultraplot.constructor.Colormap`. This calls # `~ultraplot.colors.PerceptualColormap.from_list`, which linearly interpolates # between the hues, saturations, and luminances of the input colors. To facillitate # the construction of diverging colormaps, the hue channel values for nuetral @@ -182,7 +182,7 @@ # and subsequent colors in the list, with sharp hue cutoffs at the neutral colors. # This permits generating diverging colormaps with e.g. ``['blue', 'white', 'red']``. # * Pass the keywords `hue`, `saturation`, or `luminance` (or their shorthands `h`, -# `s`, and `l`) to `~ultraplot.constructor.Colormap` without any positional arguments +# `s`, and `l`) to :class:`~ultraplot.constructor.Colormap` without any positional arguments # (or pass a dictionary containing these keys as a positional argument). # This calls `~ultraplot.colors.PerceptualColormap.from_hsl`, which # linearly interpolates between the specified channel values. Channel values can be @@ -193,7 +193,7 @@ # # To change the :ref:`colorspace ` used to construct the colormap, # use the `space` keyword. The default colorspace is ``'hsl'``. In the below example, -# we use all of these methods to make `~ultraplot.colors.PerceptualColormap`\ s +# we use all of these methods to make :class:`~ultraplot.colors.PerceptualColormap`\ s # in the ``'hsl'`` and ``'hpl'`` colorspaces. # %% @@ -255,20 +255,20 @@ # ----------------- # # To *merge* colormaps, you can pass multiple positional arguments to the -# `~ultraplot.constructor.Colormap` constructor function. This calls the +# :class:`~ultraplot.constructor.Colormap` constructor function. This calls the # `~ultraplot.colors.ContinuousColormap.append` method. Each positional # argument can be a colormap name, a colormap instance, or a # :ref:`special argument ` that generates a new colormap # on-the-fly. This lets you create new diverging colormaps and segmented # `SciVisColor `__ style colormaps -# right inside ultraplot. Segmented colormaps are often desirable for complex +# right inside UltraPlot. Segmented colormaps are often desirable for complex # datasets with complex statistical distributions. # # In the below example, we create a new divering colormap and # reconstruct the colormap from `this SciVisColor example # `__. # We also save the results for future use by passing ``save=True`` to -# `~ultraplot.constructor.Colormap`. +# :class:`~ultraplot.constructor.Colormap`. # %% import ultraplot as uplt @@ -314,34 +314,34 @@ # Modifying colormaps # ------------------- # -# ultraplot lets you create modified versions of *existing* colormaps -# using the `~ultraplot.constructor.Colormap` constructor function and the -# new `~ultraplot.colors.ContinuousColormap` and -# `~ultraplot.colors.DiscreteColormap` classes, which replace the native +# UltraPlot lets you create modified versions of *existing* colormaps +# using the :class:`~ultraplot.constructor.Colormap` constructor function and the +# new :class:`~ultraplot.colors.ContinuousColormap` and +# :class:`~ultraplot.colors.DiscreteColormap` classes, which replace the native # matplotlib colormap classes. They can be modified in the following ways: # # * To remove colors from the left or right ends of a colormap, pass `left` -# or `right` to `~ultraplot.constructor.Colormap`. This calls the -# `~ultraplot.colors.ContinuousColormap.truncate` method, and can be +# or `right` to :class:`~ultraplot.constructor.Colormap`. This calls the +# :method:`~ultraplot.colors.ContinuousColormap.truncate` method, and can be # useful when you want to use colormaps as :ref:`color cycles ` # and need to remove the light part so that your lines stand out # against the background. # * To modify the central colors of a diverging colormap, pass `cut` to -# `~ultraplot.constructor.Colormap`. This calls the +# :class:`~ultraplot.constructor.Colormap`. This calls the # `~ultraplot.colors.ContinuousColormap.cut` method, and can be used # to create a sharper cutoff between negative and positive values or (when # `cut` is negative) to expand the "neutral" region of the colormap. # * To rotate a cyclic colormap, pass `shift` to -# `~ultraplot.constructor.Colormap`. This calls the -# `~ultraplot.colors.ContinuousColormap.shifted` method. ultraplot ensures +# :class:`~ultraplot.constructor.Colormap`. This calls the +# :property:`~ultraplot.colors.ContinuousColormap.shifted` method. UltraPlot ensures # the colors at the ends of "shifted" colormaps are *distinct* so that # levels never blur together. # * To change the opacity of a colormap or add an opacity *gradation*, pass -# `alpha` to `~ultraplot.constructor.Colormap`. This calls the +# `alpha` to :class:`~ultraplot.constructor.Colormap`. This calls the # `~ultraplot.colors.ContinuousColormap.set_alpha` method, and can be # useful when *layering* filled contour or mesh elements. -# * To change the "gamma" of a `~ultraplot.colors.PerceptualColormap`, -# pass `gamma` to `~ultraplot.constructor.Colormap`. This calls the +# * To change the "gamma" of a :class:`~ultraplot.colors.PerceptualColormap`, +# pass `gamma` to :class:`~ultraplot.constructor.Colormap`. This calls the # `~ultraplot.colors.PerceptualColormap.set_gamma` method, and # controls how the luminance and saturation channels vary between colormap # segments. ``gamma > 1`` emphasizes high luminance, low saturation colors, @@ -491,11 +491,11 @@ # and `CCC-tool `__. # # To add colormaps downloaded from any of these sources, save the color data file -# to the ``cmaps`` subfolder inside `~ultraplot.config.Configurator.user_folder`, +# to the ``cmaps`` subfolder inside :func:`~ultraplot.config.Configurator.user_folder`, # or to a folder named ``ultraplot_cmaps`` in the same directory as your python session # or an arbitrary parent directory (see `~ultraplot.config.Configurator.local_folders`). -# After adding the file, call `~ultraplot.config.register_cmaps` or restart your python +# After adding the file, call :func:`~ultraplot.config.register_cmaps` or restart your python # session. You can also use `~ultraplot.colors.ContinuousColormap.from_file` or manually -# pass `~ultraplot.colors.ContinuousColormap` instances or file paths to -# `~ultraplot.config.register_cmaps`. See `~ultraplot.config.register_cmaps` +# pass :class:`~ultraplot.colors.ContinuousColormap` instances or file paths to +# :func:`~ultraplot.config.register_cmaps`. See :func:`~ultraplot.config.register_cmaps` # for a table of recognized file extensions. diff --git a/docs/colors.py b/docs/colors.py index 02ace6e2c..1a7b07f0f 100644 --- a/docs/colors.py +++ b/docs/colors.py @@ -19,7 +19,7 @@ # Color names # =========== # -# ultraplot registers several new color names and includes tools for defining +# UltraPlot registers several new color names and includes tools for defining # your own color names. These features are described below. @@ -29,28 +29,28 @@ # Included colors # --------------- # -# ultraplot adds new color names from the `XKCD color survey +# UltraPlot adds new color names from the `XKCD color survey # `__ and # the `Open Color `__ UI design color -# palettes. You can use `~ultraplot.demos.show_colors` to generate a table of these +# palettes. You can use :func:`~ultraplot.demos.show_colors` to generate a table of these # colors. Note that matplotlib's native `X11/CSS4 named colors # `__ are still # registered, but some of these color names may be overwritten by the XKCD names, # and we encourage choosing colors from the below tables instead. XKCD colors # are `available in matplotlib # `__ under the -# ``xkcd:`` prefix, but ultraplot doesn't require this prefix because the XKCD +# ``xkcd:`` prefix, but UltraPlot doesn't require this prefix because the XKCD # selection is larger and the names are generally more likely to match your # intuition for what a color "should" look like. # -# For all colors, ultraplot ensures that ``'grey'`` is a synonym of ``'gray'`` -# (for example, ``'grey5'`` and ``'gray5'`` are both valid). ultraplot also +# For all colors, UltraPlot ensures that ``'grey'`` is a synonym of ``'gray'`` +# (for example, ``'grey5'`` and ``'gray5'`` are both valid). UltraPlot also # retricts the available XKCD colors with a filtering algorithm so they are # "distinct" in :ref:`perceptually uniform space `. This # makes it a bit easier to pick out colors from the table generated with -# `~ultraplot.demos.show_colors`. The filtering algorithm also cleans up similar +# :func:`~ultraplot.demos.show_colors`. The filtering algorithm also cleans up similar # names -- for example, ``'reddish'`` and ``'reddy'`` are changed to ``'red'``. -# You can adjust the filtering algorithm by calling `~ultraplot.config.register_colors` +# You can adjust the filtering algorithm by calling :func:`~ultraplot.config.register_colors` # with the `space` or `margin` keywords. # %% @@ -65,17 +65,17 @@ # Modifying colors # ---------------- # -# ultraplot provides the top-level `~ultraplot.utils.set_alpha`, -# `~ultraplot.utils.set_hue`, `~ultraplot.utils.set_saturation`, -# `~ultraplot.utils.set_luminance`, `~ultraplot.utils.shift_hue`, -# `~ultraplot.utils.scale_saturation`, and `~ultraplot.utils.scale_luminance` +# UltraPlot provides the top-level :func:`~ultraplot.utils.set_alpha`, +# :func:`~ultraplot.utils.set_hue`, :func:`~ultraplot.utils.set_saturation`, +# :func:`~ultraplot.utils.set_luminance`, :func:`~ultraplot.utils.shift_hue`, +# :func:`~ultraplot.utils.scale_saturation`, and :func:`~ultraplot.utils.scale_luminance` # functions for quickly modifying existing colors. The ``set`` functions change # individual hue, saturation, or luminance values in the :ref:`perceptually uniform # colorspace ` specified by the `space` keyword (default is ``'hcl'``). # The ``shift`` and ``scale`` functions shift or scale the # hue, saturation, or luminance by the input value -- for example, # ``uplt.scale_luminance('color', 1.2)`` makes ``'color'`` 20% brighter. These -# are useful for creating color gradations outside of `~ultraplot.colors.Cycle` +# are useful for creating color gradations outside of :class:`~ultraplot.colors.Cycle` # or if you simply spot a color you like and want to make it a bit # brighter, less vibrant, etc. @@ -130,8 +130,8 @@ # on the discrete colormap color list. This feature is powered by the # `~ultraplot.colors.ColorDatabase` class. This is useful if you spot a # nice color in one of the available colormaps or color cycles and want -# to use it for some arbitrary plot element. Use the `~ultraplot.utils.to_rgb` or -# `~ultraplot.utils.to_rgba` functions to retrieve the RGB or RGBA channel values. +# to use it for some arbitrary plot element. Use the :func:`~ultraplot.utils.to_rgb` or +# :func:`~ultraplot.utils.to_rgba` functions to retrieve the RGB or RGBA channel values. # %% import ultraplot as uplt @@ -190,12 +190,12 @@ # --------------------- # # You can register your own colors by adding ``.txt`` files to the -# ``colors`` subfolder inside `~ultraplot.config.Configurator.user_folder`, +# ``colors`` subfolder inside :func:`~ultraplot.config.Configurator.user_folder`, # or to a folder named ``ultraplot_colors`` in the same directory as your python session -# or an arbitrary parent directory (see `~ultraplot.config.Configurator.local_folders`). -# After adding the file, call `~ultraplot.config.register_colors` or restart your python +# or an arbitrary parent directory (see :func:`~ultraplot.config.Configurator.local_folders`). +# After adding the file, call :func:`~ultraplot.config.register_colors` or restart your python # session. You can also manually pass file paths, dictionaries, ``name=color`` -# keyword arguments to `~ultraplot.config.register_colors`. Each color +# keyword arguments to :func:`~ultraplot.config.register_colors`. Each color # file should contain lines that look like ``color: #xxyyzz`` # where ``color`` is the registered color name and ``#xxyyzz`` is # the HEX value. Lines beginning with ``#`` are ignored as comments. diff --git a/docs/conf.py b/docs/conf.py index 2c2d2e427..a005280ec 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,9 @@ # The full version, including alpha/beta/rc tags release = "" +# Faster builds +parallel_read_safe = True +parallel_write_safe = True # -- Create files -------------------------------------------------------------- @@ -90,7 +93,6 @@ extensions = [ "matplotlib.sphinxext.plot_directive", # see: https://matplotlib.org/sampledoc/extensions.html # noqa: E501 "sphinx.ext.autodoc", # include documentation from docstrings - "autoapi.extension", "sphinx.ext.doctest", # >>> examples "sphinx.ext.extlinks", # for :pr:, :issue:, :commit: "sphinx.ext.autosectionlabel", # use :ref:`Heading` for any heading @@ -107,7 +109,6 @@ "nbsphinx", # parse rst books ] -autoapi_dirs = ["../ultraplot/"] # The master toctree document. master_doc = "index" @@ -131,6 +132,12 @@ "tmp", ] +autodoc_default_options = { + "private-members": False, + "special-members": False, + "undoc-members": False, +} + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. language = "en" @@ -141,7 +148,7 @@ # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -add_module_names = False # ultraplot imports everything in top-level namespace +add_module_names = False # UltraPlot imports everything in top-level namespace # Autodoc configuration. Here we concatenate class and __init__ docstrings # See: http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html @@ -171,8 +178,8 @@ # Links for What's New github commits, issues, and pull requests extlinks = { "issue": ("https://github.com/ultraplot/ultraplot/issues/%s", "GH#%s"), - "commit": ("https://github.com/ultraplot/ultraplot/commit/%s", "@%s"), - "pr": ("https://github.com/ultraplot/ultralpot/pull/%s", "GH#%s"), + "commit": ("https://github.com/Ultraplot/ultraplot/commit/%s", "@%s"), + "pr": ("https://github.com/Ultraplot/ultraplot/pull/%s", "GH#%s"), } # Set up mapping for other projects' docs @@ -185,7 +192,7 @@ "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), "xarray": ("http://xarray.pydata.org/en/stable", None), "cartopy": ("https://scitools.org.uk/cartopy/docs/latest", None), - "basemap": ("https://matplotlib.org/basemap", None), + "basemap": ("https://matplotlib.org/basemap/stable", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None), "pint": ("https://pint.readthedocs.io/en/stable/", None), } @@ -220,7 +227,7 @@ "dict-like": ":term:`dict-like `", "path-like": ":term:`path-like `", "array-like": ":term:`array-like `", - # ultraplot defined terms + # UltraPlot defined terms "unit-spec": ":py:func:`unit-spec `", "locator-spec": ":py:func:`locator-spec `", "formatter-spec": ":py:func:`formatter-spec `", @@ -308,7 +315,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, "ultraplot.tex", "UltraPlot Documentation", "UltraPlot", "manual"), + (master_doc, "UltraPlot.tex", "UltraPlot Documentation", "UltraPlot", "manual"), ] @@ -316,7 +323,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "ultraplot", "UltraPlot Documentation", [author], 1)] +man_pages = [(master_doc, "UltraPlot", "UltraPlot Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------------- @@ -327,10 +334,10 @@ texinfo_documents = [ ( master_doc, - "ultraplot", - "ultraplot Documentation", + "UltraPlot", + "UltraPlot Documentation", author, - "ultraplot", + "UltraPlot", "A succinct matplotlib wrapper for making beautiful, " "publication-quality graphics.", "Miscellaneous", @@ -342,3 +349,22 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + +from ultraplot.internals.docstring import _snippet_manager + + +def process_docstring(app, what, name, obj, options, lines): + if lines: + try: + # Create a proper format string + doc = "\n".join(lines) + expanded = doc % _snippet_manager # Use dict directly + lines[:] = expanded.split("\n") + except Exception as e: + print(f"Warning: Could not expand docstring for {name}: {e}") + # Keep original lines if expansion fails + pass + + +def setup(app): + app.connect("autodoc-process-docstring", process_docstring) diff --git a/docs/configuration.rst b/docs/configuration.rst index 6b1059e0f..b8f30def7 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4,20 +4,20 @@ .. _ug_config: -Configuring ultraplot +Configuring UltraPlot =================== Overview -------- A dictionary-like object named `~ultraplot.config.rc`, belonging to the -`~ultraplot.config.Configurator` class, is created when you import ultraplot. +`~ultraplot.config.Configurator` class, is created when you import UltraPlot. This is your one-stop shop for working with `matplotlib settings `_ stored in `~ultraplot.config.rc_matplotlib` (our name for the `~matplotlib.rcParams` dictionary) -and :ref:`ultraplot settings ` -stored in `~ultraplot.config.rc_ultraplot`. +and :ref:`ultraplot settings ` +stored in `~ultraplot.config.rc_UltraPlot`. To change global settings on-the-fly, simply update `~ultraplot.config.rc` using either dot notation or as you would any other dictionary: @@ -72,21 +72,21 @@ Matplotlib settings ------------------- Matplotlib settings are natively stored in the `~matplotlib.rcParams` -dictionary. ultraplot makes this dictionary available in the top-level namespace as +dictionary. UltraPlot makes this dictionary available in the top-level namespace as `~ultraplot.config.rc_matplotlib`. All matplotlib settings can also be changed with `~ultraplot.config.rc`. Details on the matplotlib settings can be found on `this page `_. -.. _ug_rcultraplot: +.. _ug_rcUltraPlot: -ultraplot settings +UltraPlot settings ---------------- -ultraplot settings are natively stored in the `~ultraplot.config.rc_ultraplot` dictionary. +UltraPlot settings are natively stored in the `~ultraplot.config.rc_UltraPlot` dictionary. They should almost always be changed with `~ultraplot.config.rc` rather than -`~ultraplot.config.rc_ultraplot` to ensure that :ref:`meta-settings ` are +`~ultraplot.config.rc_UltraPlot` to ensure that :ref:`meta-settings ` are synced. These settings are not found in `~matplotlib.rcParams` -- they either -control ultraplot-managed features (e.g., a-b-c labels and geographic gridlines) +control UltraPlot-managed features (e.g., a-b-c labels and geographic gridlines) or they represent existing matplotlib settings with more clear or succinct names. Here's a broad overview of the new settings: @@ -116,10 +116,10 @@ Here's a broad overview of the new settings: Meta-settings ------------- -Some ultraplot settings may be more accurately described as "meta-settings", -as they change several matplotlib and ultraplot settings at once (note that settings +Some UltraPlot settings may be more accurately described as "meta-settings", +as they change several matplotlib and UltraPlot settings at once (note that settings are only synced when they are changed on the `~ultraplot.config.rc` object rather than -the `~ultraplot.config.rc_ultraplot` and `~ultraplot.config.rc_matplotlib` dictionaries). +the `~ultraplot.config.rc_UltraPlot` and `~ultraplot.config.rc_matplotlib` dictionaries). Here's a broad overview of the "meta-settings": * Setting :rcraw:`font.small` (or, equivalently, :rcraw:`fontsmall`) changes @@ -154,7 +154,7 @@ Here's a broad overview of the "meta-settings": Table of settings ----------------- -A comprehensive table of the new ultraplot settings is shown below. +A comprehensive table of the new UltraPlot settings is shown below. .. include:: _static/rctable.rst @@ -163,11 +163,11 @@ A comprehensive table of the new ultraplot settings is shown below. The ultraplotrc file ------------------ -When you import ultraplot for the first time, a ``ultraplotrc`` file is generated with +When you import UltraPlot for the first time, a ``ultraplotrc`` file is generated with all lines commented out. This file is just like `matplotlibrc `_, -except it controls both matplotlib *and* ultraplot settings. The syntax is essentially +except it controls both matplotlib *and* UltraPlot settings. The syntax is essentially the same as matplotlibrc, and the file path is very similar to matplotlibrc. On most -platforms it is found in ``~/.ultraplot/ultraplotrc``, but a loose hidden file in the +platforms it is found in ``~/.UltraPlot/ultraplotrc``, but a loose hidden file in the home directory named ``~/.ultraplotrc`` is also allowed (use `~ultraplot.config.Configurator.user_file` to print the path). To update this file after a version change, simply remove it and restart your python session. diff --git a/docs/cycles.py b/docs/cycles.py index 5d3a63983..13e32af1d 100644 --- a/docs/cycles.py +++ b/docs/cycles.py @@ -18,19 +18,19 @@ # Color cycles # ============ # -# ultraplot defines **color cycles** or **discrete colormaps** as color palettes +# UltraPlot defines **color cycles** or **discrete colormaps** as color palettes # comprising sets of *distinct colors*. Unlike :ref:`continuous colormaps `, # interpolation between these colors may not make sense. Generally, color cycles are # used with distinct plot elements like lines and bars. Occasionally, -# they are used with categorical data as "qualitative" colormaps. ultraplot's -# color cycles are registered as `~ultraplot.colors.DiscreteColormap`\ s, +# they are used with categorical data as "qualitative" colormaps. UltraPlot's +# color cycles are registered as :class:`~ultraplot.colors.DiscreteColormap`\ s, # and can be easily converted into `property cyclers # `__ -# for use with distinct plot elements using the `~ultraplot.constructor.Cycle` -# constructor function. `~ultraplot.constructor.Cycle` can also -# :ref:`extract colors ` from `~ultraplot.colors.ContinuousColormap`\ s. +# for use with distinct plot elements using the :class:`~ultraplot.constructor.Cycle` +# constructor function. :class:`~ultraplot.constructor.Cycle` can also +# :ref:`extract colors ` from :class:`~ultraplot.colors.ContinuousColormap`\ s. # -# ultraplot :ref:`adds several features ` to help you use color +# UltraPlot :ref:`adds several features ` to help you use color # cycles effectively in your figures. This section documents the new registered # color cycles, explains how to make and modify color cycles, and shows how to # apply them to your plots. @@ -42,12 +42,12 @@ # Included color cycles # --------------------- # -# Use `~ultraplot.demos.show_cycles` to generate a table of registered color -# cycles. The table includes the default color cycles registered by ultraplot and -# "user" color cycles created with the `~ultraplot.constructor.Cycle` constructor -# function or loaded from `~ultraplot.config.Configurator.user_folder`. If you need +# Use :func:`~ultraplot.demos.show_cycles` to generate a table of registered color +# cycles. The table includes the default color cycles registered by UltraPlot and +# "user" color cycles created with the :class:`~ultraplot.constructor.Cycle` constructor +# function or loaded from :func:`~ultraplot.config.Configurator.user_folder`. If you need # the list of colors associated with a registered or on-the-fly color cycle, -# simply use `~ultraplot.utils.get_colors`. +# simply use :func:`~ultraplot.utils.get_colors`. # %% import ultraplot as uplt @@ -61,14 +61,14 @@ # Changing the color cycle # ------------------------ # -# Most 1D `~ultraplot.axes.PlotAxes` commands like `~ultraplot.axes.PlotAxes.line` -# and `~ultraplot.axes.PlotAxes.scatter` accept a `cycle` keyword (see the +# Most 1D :class:`~ultraplot.axes.PlotAxes` commands like :func:`~ultraplot.axes.PlotAxes.line` +# and :func:`~ultraplot.axes.PlotAxes.scatter` accept a `cycle` keyword (see the # :ref:`1D plotting section `). This can be used to change the # color cycle on-the-fly, whether plotting with successive calls to -# `~ultraplot.axes.PlotAxes` commands or a single call using 2D array(s) (see +# :class:`~ultraplot.axes.PlotAxes` commands or a single call using 2D array(s) (see # the :ref:`1D plotting section `). To change the global property -# cycler, pass a `~ultraplot.colors.DiscreteColormap` or cycle name -# to :rcraw:`cycle` or pass the result of `~ultraplot.constructor.Cycle` +# cycler, pass a :class:`~ultraplot.colors.DiscreteColormap` or cycle name +# to :rcraw:`cycle` or pass the result of :class:`~ultraplot.constructor.Cycle` # to :rcraw:`axes.prop_cycle` (see the :ref:`configuration guide `). # %% @@ -108,31 +108,31 @@ # Making color cycles # ------------------- # -# ultraplot includes tools for merging color cycles, modifying existing color +# UltraPlot includes tools for merging color cycles, modifying existing color # cycles, making new color cycles, and saving color cycles for future use. -# Most of these features can be accessed via the `~ultraplot.constructor.Cycle` +# Most of these features can be accessed via the :class:`~ultraplot.constructor.Cycle` # :ref:`constructor function `. This command returns -# `~cycler.Cycler` instances whose `color` properties are determined by the +# :class:`~cycler.Cycler` instances whose `color` properties are determined by the # positional arguments (see :ref:`below ` for changing other -# properties). Note that every `~ultraplot.axes.PlotAxes` command that accepts a +# properties). Note that every :class:`~ultraplot.axes.PlotAxes` command that accepts a # `cycle` keyword passes it through this function (see the :ref:`1D plotting # section `). -# Positional arguments passed to `~ultraplot.constructor.Cycle` are interpreted -# by the `~ultraplot.constructor.Colormap` constructor function. If the result -# is a `~ultraplot.colors.DiscreteColormap`, those colors are used for the resulting -# `~cycler.Cycler`. If the result is a `~ultraplot.colors.ContinuousColormap`, the +# Positional arguments passed to :class:`~ultraplot.constructor.Cycle` are interpreted +# by the :class:`~ultraplot.constructor.Colormap` constructor function. If the result +# is a :class:`~ultraplot.colors.DiscreteColormap`, those colors are used for the resulting +# :class:`~cycler.Cycler`. If the result is a :class:`~ultraplot.colors.ContinuousColormap`, the # colormap is sampled at `N` discrete values -- for example, ``uplt.Cycle('Blues', 5)`` # selects 5 evenly-spaced values. When building color cycles on-the-fly, for example -# with ``ax.plot(data, cycle='Blues')``, ultraplot automatically selects as many colors +# with ``ax.plot(data, cycle='Blues')``, UltraPlot automatically selects as many colors # as there are columns in the 2D array (i.e., if we are drawing 10 lines using an array -# with 10 columns, ultraplot will select 10 evenly-spaced values from the colormap). +# with 10 columns, UltraPlot will select 10 evenly-spaced values from the colormap). # To exclude near-white colors on the end of a colormap, pass e.g. ``left=x`` -# to `~ultraplot.constructor.Cycle`, or supply a plotting command with e.g. +# to :class:`~ultraplot.constructor.Cycle`, or supply a plotting command with e.g. # ``cycle_kw={'left': x}``. See the :ref:`colormaps section ` for details. # # In the below example, several color cycles are constructed from scratch, and -# the lines are referenced with colorbars and legends. Note that ultraplot permits +# the lines are referenced with colorbars and legends. Note that UltraPlot permits # generating colorbars from :ref:`lists of artists `. # %% @@ -165,8 +165,8 @@ # Cycles of other properties # -------------------------- # -# `~ultraplot.constructor.Cycle` can generate `~cycler.Cycler` instances that -# change `~ultraplot.axes.PlotAxes.line` and `~ultraplot.axes.PlotAxes.scatter` +# :class:`~ultraplot.constructor.Cycle` can generate :class:`~cycler.Cycler` instances that +# change :func:`~ultraplot.axes.PlotAxes.line` and :func:`~ultraplot.axes.PlotAxes.scatter` # properties other than `color`. In the below example, a single-color line # property cycler is constructed and applied to the axes locally using the # line properties `lw` and `dashes` (the aliases `linewidth` or `linewidths` @@ -210,11 +210,11 @@ # and `Color Drop `__. # To add color cycles downloaded from any of these sources, save the color data file -# to the ``cycles`` subfolder inside `~ultraplot.config.Configurator.user_folder`, +# to the ``cycles`` subfolder inside :func:`~ultraplot.config.Configurator.user_folder`, # or to a folder named ``ultraplot_cycles`` in the same directory as your python session -# or an arbitrary parent directory (see `~ultraplot.config.Configurator.local_folders`). -# After adding the file, call `~ultraplot.config.register_cycles` or restart your python -# session. You can also use `~ultraplot.colors.DiscreteColormap.from_file` or manually -# pass `~ultraplot.colors.DiscreteColormap` instances or file paths to -# `~ultraplot.config.register_cycles`. See `~ultraplot.config.register_cycles` +# or an arbitrary parent directory (see :func:`~ultraplot.config.Configurator.local_folders`). +# After adding the file, call :func:`~ultraplot.config.register_cycles` or restart your python +# session. You can also use :func:`~ultraplot.colors.DiscreteColormap.from_file` or manually +# pass :class:`~ultraplot.colors.DiscreteColormap` instances or file paths to +# :func:`~ultraplot.config.register_cycles`. See :func:`~ultraplot.config.register_cycles` # for a table of recognized data file extensions. diff --git a/docs/external-links.rst b/docs/external-links.rst index 6bef24c95..f152678a3 100644 --- a/docs/external-links.rst +++ b/docs/external-links.rst @@ -9,8 +9,8 @@ This page contains links to related external projects. Python packages =============== -The following packages inspired ultraplot, are required or optional -dependencies of ultraplot, or are distributed with ultraplot: +The following packages inspired UltraPlot, are required or optional +dependencies of UltraPlot, or are distributed with UltraPlot: * `matplotlib `__ - The powerful data visualization package we all know and love. @@ -33,22 +33,22 @@ dependencies of ultraplot, or are distributed with ultraplot: It is not generally suitable for geophysical data. * `hsluv-python `__ - A python implementation of `HSLuv `__ used for - the hue, saturation, luminance math required by `~ultraplot.colors.PerceptualColormap`. + the hue, saturation, luminance math required by :class:`~ultraplot.colors.PerceptualColormap`. * `TeX Gyre `__ - An open source re-implementation of popular fonts like `Helvetica `__ and `Century `__. - These are distributed with ultraplot and used for its default font families. + These are distributed with UltraPlot and used for its default font families. * `Fira Math `__ - An open source sans-serif font with a zillion glyphs for mathematical symbols. - This is distributed with ultraplot as a viable alternative to + This is distributed with UltraPlot as a viable alternative to `DejaVu Sans `__. Downloadable colormaps ====================== The following colormap repositories are -imported and registered by ultraplot. +imported and registered by UltraPlot. * `Color Brewer `__ - The O.G. perceptually uniform colormap distribution. These are included with @@ -71,12 +71,12 @@ Tools for making new colormaps ============================== Use these resources to make colormaps from scratch. Then import -them into ultraplot by adding files to the ``.ultraplot/cmaps`` folder +them into UltraPlot by adding files to the ``.UltraPlot/cmaps`` folder (see :ref:`this section ` for details). -* `The ultraplot API `__ - - Namely, the `~ultraplot.colors.ContinuousColormap` class and - `~ultraplot.constructor.Colormap` constructor function. +* `The UltraPlot API `__ - + Namely, the :class:`~ultraplot.colors.ContinuousColormap` class and + :class:`~ultraplot.constructor.Colormap` constructor function. * `HCL Wizard `__ - An advanced interface for designing perceptually uniform colormaps, with example plots, channel plots, and lots of sliders. @@ -97,12 +97,12 @@ Tools for making new color cycles ================================= Use these resources to make color cycles from scratch. Then import -them into ultraplot by adding files to the ``.ultraplot/cycles`` folder +them into UltraPlot by adding files to the ``.UltraPlot/cycles`` folder (see :ref:`this section ` for details). -* `The ultraplot API `__ - - Namely, the `~ultraplot.colors.DiscreteColormap` class and - `~ultraplot.constructor.Cycle` constructor function. +* `The UltraPlot API `__ - + Namely, the :class:`~ultraplot.colors.DiscreteColormap` class and + :class:`~ultraplot.constructor.Cycle` constructor function. * `i want hue `__ - An advanced interface for generating perceptually distinct color sets with options for restricting the hue, chroma, and luminance ranges. diff --git a/docs/faq.rst b/docs/faq.rst index e5f5aa773..ad528797d 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -10,63 +10,63 @@ There is already a great matplotlib wrapper called `__ and `xarray `__ both offer convenient matplotlib plotting commands. -How does ultraplot compare against these tools? +How does UltraPlot compare against these tools? -* ultraplot, seaborn, pandas, and xarray all offer tools for generating rigid, simple, - nice-looking plots from data stored in `~pandas.DataFrame`\ s and - `~xarray.DataArray`\ s (ultraplot tries to apply labels from these objects, just like +* UltraPlot, seaborn, pandas, and xarray all offer tools for generating rigid, simple, + nice-looking plots from data stored in :class:`~pandas.DataFrame`\ s and + :class:`~xarray.DataArray`\ s (UltraPlot tries to apply labels from these objects, just like pandas and xarray). -* ultraplot is integrated with *cartopy* and *basemap*. You will find plotting geophysical - data in ultraplot to be much more concise than working with cartopy and basemap +* UltraPlot is integrated with *cartopy* and *basemap*. You will find plotting geophysical + data in UltraPlot to be much more concise than working with cartopy and basemap directly. -* ultraplot *expands upon* the seaborn tools for working with color and global settings. - For example, see `~ultraplot.constructor.Colormap`, - `~ultraplot.colors.PerceptualColormap`, and `~ultraplot.config.Configurator`. -* ultraplot *expands upon* matplotlib by fixing various quirks, developing a more +* UltraPlot *expands upon* the seaborn tools for working with color and global settings. + For example, see :class:`~ultraplot.constructor.Colormap`, + :class:`~ultraplot.colors.PerceptualColormap`, and :class:`~ultraplot.config.Configurator`. +* UltraPlot *expands upon* matplotlib by fixing various quirks, developing a more advanced automatic layout algorithm, simplifying the process of drawing outer colorbars and legends, and much more. -* ultraplot is *built right into the matplotlib API*, thanks to special subclasses of the - `~matplotlib.figure.Figure` and `~matplotlib.axes.Axes` classes, while seaborn, +* UltraPlot is *built right into the matplotlib API*, thanks to special subclasses of the + :class:`~matplotlib.figure.Figure` and :class:`~matplotlib.axes.Axes` classes, while seaborn, pandas, and xarray are meant to be used separately from the matplotlib API. -In a nutshell, ultraplot is intended to *unify the convenience of seaborn, pandas, and +In a nutshell, UltraPlot is intended to *unify the convenience of seaborn, pandas, and xarray plotting with the power and customizability of the underlying matplotlib API*. .. - So while ultraplot includes similar tools, the scope and goals are largely different. - Indeed, parts of ultraplot were inspired by these projects -- in particular, + So while UltraPlot includes similar tools, the scope and goals are largely different. + Indeed, parts of UltraPlot were inspired by these projects -- in particular, ``setup.py`` and ``colortools.py`` are modeled after seaborn. However the goals and - scope of ultraplot are largely different: + scope of UltraPlot are largely different: Why didn't you add to matplotlib directly? ========================================== -Since ultraplot is built right into the matplotlib API, you might be wondering why we +Since UltraPlot is built right into the matplotlib API, you might be wondering why we didn't contribute to the matplotlib project directly. -* Certain features directly conflict with matplotlib. For example, ultraplot's tight +* Certain features directly conflict with matplotlib. For example, UltraPlot's tight layout algorithm conflicts with matplotlib's `tight layout `__ by - permitting *fluid figure dimensions*, and the new `~ultraplot.gridspec.GridSpec` class + permitting *fluid figure dimensions*, and the new :class:`~ultraplot.gridspec.GridSpec` class permits *variable spacing* between rows and columns and uses *physical units* rather than figure-relative and axes-relative units. -* Certain features are arguably too redundant. For example, `~ultraplot.axes.Axes.format` +* Certain features are arguably too redundant. For example, :func:`~ultraplot.axes.Axes.format` is convenient, but the same tasks can be accomplished with existing axes and axis - "setter" methods. Also, some of the functionality of `~ultraplot.ui.subplots` can be + "setter" methods. Also, some of the functionality of :func:`~ultraplot.ui.subplots` can be replicated with `axes_grid1 `__. Following `TOOWTDI `__ philosophy, these features should probably not be integrated. .. - * ultraplot design choices are made with the academic scientist working with ipython + * UltraPlot design choices are made with the academic scientist working with ipython notebooks in mind, while matplotlib has a much more diverse base of hundreds of thousands of users. Matplotlib developers have to focus on support and API - consistency, while ultraplot can make more dramatic improvements. + consistency, while UltraPlot can make more dramatic improvements. .. Nevertheless, if any core matplotlib developers think that some - of ultraplot's features should be added to matplotlib, please contact + of UltraPlot's features should be added to matplotlib, please contact `Luke Davis `__ and let him know! Why do my inline figures look different? @@ -86,12 +86,12 @@ keep them legible, matplotlib uses a fairly large default figure width of 6.5 in downscaled so the sizes used in your plotting code are *not* the sizes that appear in the document. -ultraplot helps you get your figure sizes *correct* for embedding them as vector graphics +UltraPlot helps you get your figure sizes *correct* for embedding them as vector graphics inside publications. It uses a slightly smaller default font size, calculates the default figure size from the number of subplot rows and columns, and adds the `journal` -keyword argument to `~ultraplot.figure.Figure` which can be used to employ figure +keyword argument to :class:`~ultraplot.figure.Figure` which can be used to employ figure dimensions from a particular journal standard. To keep the inline figures legible, -ultraplot also employs a *higher quality* default inline backend. +UltraPlot also employs a *higher quality* default inline backend. .. [1] `Vector graphics `__ use physical units (e.g. inches, `points `__), diff --git a/docs/fonts.py b/docs/fonts.py index 40575dcb4..e1212c30a 100644 --- a/docs/fonts.py +++ b/docs/fonts.py @@ -20,7 +20,7 @@ # Font selection # ============== # -# ultraplot registers several new fonts and includes tools +# UltraPlot registers several new fonts and includes tools # for adding your own fonts. These features are described below. # # @@ -43,9 +43,9 @@ # Matplotlib uses DejaVu Sans in part because it includes glyphs for a very wide # range of symbols, especially mathematical symbols. However in our opinion, # DejaVu Sans is not very aesthetically pleasing. To improve the font selection while -# keeping things consistent across different workstations, ultraplot is packaged +# keeping things consistent across different workstations, UltraPlot is packaged # the open source `TeX Gyre fonts `__ and a few -# additional open source sans-serif fonts. ultraplot also uses the TeX Gyre fonts as the +# additional open source sans-serif fonts. UltraPlot also uses the TeX Gyre fonts as the # first (i.e., default) entries for each of matplotlib's `font family lists # `__: # @@ -60,14 +60,14 @@ # * The `Courier `__ lookalike # :rcraw:`font.monospace` = ``'TeX Gyre Cursor'``. # -# After importing ultraplot, the default matplotlib font will be +# After importing UltraPlot, the default matplotlib font will be # `TeX Gyre Heros `__, which # emulates the more conventional and (in our opinion) aesthetically pleasing # font `Helvetica `__. The default font # family lists are shown in the :ref:`default ultraplotrc file `. -# To compare different fonts, use the `~ultraplot.demos.show_fonts` command with the +# To compare different fonts, use the :func:`~ultraplot.demos.show_fonts` command with the # `family` keyword (default behavior is ``family='sans-serif'``). Tables of the TeX -# Gyre and sans-serif fonts packaged with ultraplot are shown below. +# Gyre and sans-serif fonts packaged with UltraPlot are shown below. # %% import ultraplot as uplt @@ -87,36 +87,36 @@ # # In matplotlib, math text rendered by TeX can be produced by surrounding # an expression with ``$dollar signs$``. To help math text jive better with -# the new default :ref:`non-math text font `, ultraplot changes +# the new default :ref:`non-math text font `, UltraPlot changes # :rcraw:`mathtext.fontset` to ``'custom'``. This means that math is drawn with # the italicized version of the non-math font (see the matplotlib `math text # guide `__ # for details). This generally improves the appearance of figures with simple # math expressions. However, if you need unusual math symbols or complex math # operators, you may want to change :rcraw:`font.name` to something more suitable -# for math (e.g., the ultraplot-packaged font ``'Fira Math'`` or the matplotlib-packaged +# for math (e.g., the UltraPlot-packaged font ``'Fira Math'`` or the matplotlib-packaged # font ``'DejaVu Sans'``; see `this page `__ for # more on Fira Math). Alternatively, you can change the math text font alone by setting # :rcraw:`mathtext.fontset` back to one of matplotlib's math-specialized font sets # (e.g., ``'stixsans'`` or ``'dejavusans'``). # -# A table of math text containing the sans-serif fonts packaged with ultraplot is shown +# A table of math text containing the sans-serif fonts packaged with UltraPlot is shown # below. The dummy glyph "¤" is shown where a given math character is unavailable # for a particular font (in practice, the fallback font :rc:`mathtext.fallback` is used -# whenever a math character is unavailable, but `~ultraplot.demos.show_fonts` disables +# whenever a math character is unavailable, but :func:`~ultraplot.demos.show_fonts` disables # this fallback font in order to highlight the missing characters). # # .. note:: # -# ultraplot modifies matplotlib's math text internals so that the ``'custom'`` +# UltraPlot modifies matplotlib's math text internals so that the ``'custom'`` # font set can be applied with modifications to the currently active non-math # font rather than only a global font family. This works by changing the default # values of :rcraw:`mathtext.bf`, :rcraw:`mathtext.it`, :rcraw:`mathtext.rm`, # :rcraw:`mathtext.sf` from the global default font family ``'sans'`` to the local # font family ``'regular'``, where ``'regular'`` is a dummy name permitted by -# ultraplot (see the :ref:`ultraplotrc file ` for details). This means +# UltraPlot (see the :ref:`ultraplotrc file ` for details). This means # that if :rcraw:`mathtext.fontset` is ``'custom'`` and the font family is changed -# for an arbitrary `~matplotlib.text.Text` instance, then any LaTeX-generated math +# for an arbitrary :class:`~matplotlib.text.Text` instance, then any LaTeX-generated math # in the text string will also use this font family. # %% @@ -131,10 +131,10 @@ # -------------------- # # You can register your own fonts by adding files to the ``fonts`` subfolder -# inside `~ultraplot.config.Configurator.user_folder` and calling -# `~ultraplot.config.register_fonts`. This command is called on import. You can -# also manually pass file paths to `~ultraplot.config.register_fonts`. -# To change the default font, use the `~ultraplot.config.rc` +# inside :func:`~ultraplot.config.Configurator.user_folder` and calling +# :func:`~ultraplot.config.register_fonts`. This command is called on import. You can +# also manually pass file paths to :func:`~ultraplot.config.register_fonts`. +# To change the default font, use the :func:`~ultraplot.config.rc` # object or modify your ``ultraplotrc``. See the # :ref:`configuration section ` for details. # @@ -142,12 +142,12 @@ # is not stored under the matplotlib-compatible ``.ttf``, ``.otf``, or ``.afm`` # formats. For example, several macOS fonts are unavailable because they are # stored as ``.dfont`` collections. Also, while matplotlib nominally supports -# ``.ttc`` collections, ultraplot ignores them because figures with ``.ttc`` fonts +# ``.ttc`` collections, UltraPlot ignores them because figures with ``.ttc`` fonts # `cannot be saved as PDFs `__. # You can get matplotlib to use ``.dfont`` and ``.ttc`` collections by # expanding them into individual ``.ttf`` files with the # `DFontSplitter application `__, -# then saving the files in-place or in the ``~/.ultraplot/fonts`` folder. +# then saving the files in-place or in the ``~/.UltraPlot/fonts`` folder. # # To find font collections, check the paths listed in ``OSXFontDirectories``, # ``X11FontDirectories``, ``MSUserFontDirectories``, and ``MSFontDirectories`` diff --git a/docs/index.rst b/docs/index.rst index 3a98c21ba..674ad6119 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ .. - ultraplot documentation master file, created by + UltraPlot documentation master file, created by sphinx-quickstart on Wed Feb 20 01:31:20 2019. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. @@ -10,7 +10,7 @@ UltraPlot A succinct `matplotlib `__ wrapper for making beautiful, publication-quality graphics. This project -is `published on GitHub `__ and can +is `published on GitHub `__ and can be cited using its `Zenodo DOI `__. .. toctree:: diff --git a/docs/insets_panels.py b/docs/insets_panels.py index cb3a00179..8d306f566 100644 --- a/docs/insets_panels.py +++ b/docs/insets_panels.py @@ -26,37 +26,37 @@ # # It is often useful to have narrow "panels" along the edge of a larger # subplot for plotting secondary 1-dimensional datasets or summary statistics. -# In ultraplot, you can generate panels using the `~ultraplot.axes.Axes.panel_axes` -# command (or its shorthand, `~ultraplot.axes.Axes.panel`). The panel location +# In UltraPlot, you can generate panels using the :func:`~ultraplot.axes.Axes.panel_axes` +# command (or its shorthand, :func:`~ultraplot.axes.Axes.panel`). The panel location # is specified with a string, e.g. ``ax.panel('r')`` or ``ax.panel('right')`` # for a right-hand side panel, and the resulting panels are instances of # `~ultraplot.axes.CartesianAxes`. By default, the panel shares its axis limits, # axis labels, tick positions, and tick labels with the main subplot, but # this can be disabled by passing ``share=False``. To generate "stacked" panels, -# call `~ultraplot.axes.Axes.panel_axes` more than once. To generate several -# panels at once, call `~ultraplot.gridspec.SubplotGrid.panel_axes` on -# the `~ultraplot.gridspec.SubplotGrid` returned by `~ultraplot.figure.Figure.subplots`. +# call :func:`~ultraplot.axes.Axes.panel_axes` more than once. To generate several +# panels at once, call :func:`~ultraplot.gridspec.SubplotGrid.panel_axes` on +# the :class:`~ultraplot.gridspec.SubplotGrid` returned by :func:`~ultraplot.figure.Figure.subplots`. # # In the first example below, the distances are automatically adjusted by the # :ref:`tight layout algorithm ` according to the `pad` keyword # (the default is :rcraw:`subplots.panelpad` -- this can be changed for an entire -# figure by passing `panelpad` to `~ultraplot.figure.Figure`). In the second example, +# figure by passing `panelpad` to :class:`~ultraplot.figure.Figure`). In the second example, # the tight layout algorithm is overriden by manually setting the `space` to ``0``. # Panel widths are specified in physical units, with the default controlled # by :rcraw:`subplots.panelwidth`. This helps preserve the look of the # figure if the figure size changes. Note that by default, panels are excluded # when centering :ref:`spanning axis labels ` and super titles -- -# to include the panels, pass ``includepanels=True`` to `~ultraplot.figure.Figure`. +# to include the panels, pass ``includepanels=True`` to :class:`~ultraplot.figure.Figure`. # # .. important:: # -# ultraplot adds panel axes by allocating new rows and columns in the -# `~ultraplot.gridspec.GridSpec` rather than "stealing" space from the parent -# subplot (note that subsequently indexing the `~ultraplot.gridspec.GridSpec` will +# UltraPlot adds panel axes by allocating new rows and columns in the +# :class:`~ultraplot.gridspec.GridSpec` rather than "stealing" space from the parent +# subplot (note that subsequently indexing the :class:`~ultraplot.gridspec.GridSpec` will # ignore the slots allocated for panels). This approach means that panels # :ref:`do not affect subplot aspect ratios ` and # :ref:`do not affect subplot spacing `, which lets -# ultraplot avoid relying on complicated `"constrained layout" algorithms +# UltraPlot avoid relying on complicated `"constrained layout" algorithms # `__ # and tends to improve the appearance of figures with even the # most complex arrangements of subplots and panels. @@ -153,14 +153,14 @@ # # `Inset axes # `__ -# can be generated with the `~ultraplot.axes.Axes.inset_axes` command (or its -# shorthand, `~ultraplot.axes.Axes.inset`). To generate several insets at once, call -# `~ultraplot.gridspec.SubplotGrid.inset_axes` on the `~ultraplot.gridspec.SubplotGrid` -# returned by `~ultraplot.figure.Figure.subplots`. By default, inset axes have the +# can be generated with the :func:`~ultraplot.axes.Axes.inset_axes` command (or its +# shorthand, :func:`~ultraplot.axes.Axes.inset`). To generate several insets at once, call +# :func:`~ultraplot.gridspec.SubplotGrid.inset_axes` on the :class:`~ultraplot.gridspec.SubplotGrid` +# returned by :func:`~ultraplot.figure.Figure.subplots`. By default, inset axes have the # same projection as the parent axes, but you can also request a :ref:`different # projection ` (e.g., ``ax.inset_axes(bounds, proj='polar')``). When # the axes are both `~ultraplot.axes.CartesianAxes`, you can pass ``zoom=True`` -# to `~ultraplot.axes.Axes.inset_axes` to quickly add a "zoom indication" box and +# to :func:`~ultraplot.axes.Axes.inset_axes` to quickly add a "zoom indication" box and # lines (this uses `~matplotlib.axes.Axes.indicate_inset_zoom` internally). The box # and line positions automatically follow the axis limits of the inset axes and parent # axes. To modify the zoom line properties, you can pass a dictionary to `zoom_kw`. diff --git a/docs/projections.py b/docs/projections.py index a7276e2d9..eb194cbf9 100644 --- a/docs/projections.py +++ b/docs/projections.py @@ -29,7 +29,7 @@ # This section documents several useful features for working with `polar`_ plots # and :ref:`geographic projections `. The geographic features are powered by # `cartopy`_ (or, optionally, `basemap`_). Note that these features are *optional* -- -# installation of cartopy or basemap are not required to use ultraplot. +# installation of cartopy or basemap are not required to use UltraPlot. # # %% [raw] raw_mimetype="text/restructuredtext" # .. _ug_polar: @@ -39,14 +39,14 @@ # # To create `polar axes `_, pass ``proj='polar'`` to an axes-creation # command like `ultraplot.figure.Figure.add_subplot`. Polar axes are represented with the -# `~ultraplot.axes.PolarAxes` subclass, which has its own `~ultraplot.axes.PolarAxes.format` +# :class:`~ultraplot.axes.PolarAxes` subclass, which has its own :func:`~ultraplot.axes.PolarAxes.format` # command. `ultraplot.axes.PolarAxes.format` facilitates polar-specific modifications # like changing the central radius `r0`, the zero azimuth location `theta0`, # and the positive azimuthal direction `thetadir`. It also supports toggling and # configuring the "major" and "minor" gridline locations with `grid`, `rlocator`, # `thetalocator`, `gridminor`, `rminorlocator`, and `thetaminorlocator` and formatting # the gridline labels with `rformatter` and `thetaformatter` (analogous to `xlocator`, -# `xformatter`, and `xminorlocator` used by `ultraplot.axes.CartesianAxes.format`), +# `xformatter`, and `xminorlocator` used by :func:`ultraplot.axes.CartesianAxes.format`), # and creating "annular" or "sector" plots by changing the radial or azimuthal # bounds `rlim` and `thetalim`. Finally, since `ultraplot.axes.PolarAxes.format` # calls `ultraplot.axes.Axes.format`, it can be used to add axes titles, a-b-c @@ -116,18 +116,18 @@ # To create geographic axes, pass ``proj='name'`` to an axes-creation command like # `ultraplot.figure.Figure.add_subplot`, where ``name`` is any valid :ref:`PROJ projection # name `. Alternatively, you can pass a `cartopy.crs.Projection` or -# `~mpl_toolkits.basemap.Basemap` instance returned by the `~ultraplot.constructor.Proj` +# `~mpl_toolkits.basemap.Basemap` instance returned by the :class:`~ultraplot.constructor.Proj` # :ref:`constructor function ` to `proj` (see below for details). If # you want to create your subplots :ref:`all-at-once ` with e.g. -# `~ultraplot.ui.subplots` but need different projections for each subplot, you can pass +# :func:`~ultraplot.ui.subplots` but need different projections for each subplot, you can pass # a list or dictionary to the `proj` keyword (e.g., ``proj=('cartesian', 'pcarree')`` -# or ``proj={2: 'pcarree'}`` -- see `~ultraplot.figure.Figure.subplots` for details). +# or ``proj={2: 'pcarree'}`` -- see :func:`~ultraplot.figure.Figure.subplots` for details). # Geographic axes are represented with the `~ultraplot.axes.GeoAxes` subclass, which -# has its own `~ultraplot.axes.GeoAxes.format` command. `ultraplot.axes.GeoAxes.format` +# has its own :func:`~ultraplot.axes.GeoAxes.format` command. `ultraplot.axes.GeoAxes.format` # facilitates :ref:`geographic-specific modifications ` like meridional # and parallel gridlines and land mass outlines. The syntax is very similar to -# `ultraplot.axes.CartesianAxes.format`. Note that the `proj` keyword and several of -# the `~ultraplot.axes.GeoAxes.format` keywords are inspired by the basemap API. +# :func:`ultraplot.axes.CartesianAxes.format`. Note that the `proj` keyword and several of +# the :func:`~ultraplot.axes.GeoAxes.format` keywords are inspired by the basemap API. # In the below example, we create and format a very simple geographic plot. # %% @@ -158,13 +158,13 @@ # * Cartopy is the default backend. When you request projection names with cartopy # as the backend (or pass a `cartopy.crs.Projection` to the `proj` keyword), the # returned axes is a subclass of `cartopy.mpl.geoaxes.GeoAxes`. Under the hood, -# invoking `~ultraplot.axes.GeoAxes.format` with cartopy as the backend changes map +# invoking :func:`~ultraplot.axes.GeoAxes.format` with cartopy as the backend changes map # bounds using `~cartopy.mpl.geoaxes.GeoAxes.set_extent`, adds major and minor # gridlines using `~cartopy.mpl.geoaxes.GeoAxes.gridlines`, and adds geographic # features using `~cartopy.mpl.geoaxes.GeoAxes.add_feature`. If you prefer, you can # use the standard `cartopy.mpl.geoaxes.GeoAxes` methods just like you would in # cartopy. If you need to use the underlying `~cartopy.crs.Projection` instance, it -# is available via the `~ultraplot.axes.GeoAxes.projection` attribute. If you want +# is available via the :func:`~ultraplot.axes.GeoAxes.projection` attribute. If you want # to work with the projection classes directly, they are available in the # top-level namespace (e.g., ``proj=uplt.PlateCarre()`` is allowed). # @@ -176,14 +176,14 @@ # pcolormesh, quiver, streamplot, and barb to the identically named methods on # the `~mpl_toolkits.basemap.Basemap` instance. This means you can work # with the standard axes plotting methods rather than the basemap methods -- -# just like cartopy. Under the hood, invoking `~ultraplot.axes.GeoAxes.format` +# just like cartopy. Under the hood, invoking :func:`~ultraplot.axes.GeoAxes.format` # with basemap as the backend adds major and minor gridlines using -# `~mpl_toolkits.basemap.Basemap.drawmeridians` and -# `~mpl_toolkits.basemap.Basemap.drawparallels` and adds geographic features -# using methods like `~mpl_toolkits.basemap.Basemap.fillcontinents` -# and `~mpl_toolkits.basemap.Basemap.drawcoastlines`. If you need to +# :func:`~mpl_toolkits.basemap.Basemap.drawmeridians` and +# :func:`~mpl_toolkits.basemap.Basemap.drawparallels` and adds geographic features +# using methods like :func:`~mpl_toolkits.basemap.Basemap.fillcontinents` +# and :func:`~mpl_toolkits.basemap.Basemap.drawcoastlines`. If you need to # use the underlying `~mpl_toolkits.basemap.Basemap` instance, it is -# available as the `~ultraplot.axes.GeoAxes.projection` attribute. +# available as the :func:`~ultraplot.axes.GeoAxes.projection` attribute. # # Together, these features let you work with geophysical data without invoking # verbose cartopy classes like `~cartopy.crs.LambertAzimuthalEqualArea` or @@ -194,20 +194,20 @@ # # .. important:: # -# * By default, ultraplot bounds polar cartopy projections like +# * By default, UltraPlot bounds polar cartopy projections like # `~cartopy.crs.NorthPolarStereo` at the equator and gives non-polar cartopy # projections global extent by calling `~cartopy.mpl.geoaxes.GeoAxes.set_global`. # This is a deviation from cartopy, which determines map boundaries automatically # based on the coordinates of the plotted content. To revert to cartopy's # default behavior, set :rcraw:`geo.extent` to ``'auto`` or pass ``extent='auto'`` -# to `~ultraplot.axes.GeoAxes.format`. -# * By default, ultraplot gives circular boundaries to polar cartopy and basemap +# to :func:`~ultraplot.axes.GeoAxes.format`. +# * By default, UltraPlot gives circular boundaries to polar cartopy and basemap # projections like `~cartopy.crs.NorthPolarStereo` (see `this example # `__ # from the cartopy website). To disable this feature, set :rcraw:`geo.round` to -# ``False`` or pass ``round=False` to `~ultraplot.axes.GeoAxes.format`. Please note +# ``False`` or pass ``round=False` to :func:`~ultraplot.axes.GeoAxes.format`. Please note # that older versions of cartopy cannot add gridlines to maps bounded by circles. -# * To make things more consistent, the `~ultraplot.constructor.Proj` constructor +# * To make things more consistent, the :class:`~ultraplot.constructor.Proj` constructor # function lets you supply native `PROJ `__ keyword names # for the cartopy `~cartopy.crs.Projection` classes (e.g., `lon0` instead # of `central_longitude`) and instantiates `~mpl_toolkits.basemap.Basemap` @@ -221,7 +221,7 @@ # and will not work with matplotlib versions more recent than 3.2.2. We originally # included basemap support because its gridline labeling was more powerful # than cartopy gridline labeling. However, as cartopy gridline labeling has -# significantly improved since version 0.18, ultraplot may deprecate basemap support +# significantly improved since version 0.18, UltraPlot may deprecate basemap support # in a future release and fully remove basemap support by version 1.0.0. # %% @@ -257,20 +257,20 @@ # Plotting in projections # ----------------------- # -# In ultraplot, plotting with `~ultraplot.axes.GeoAxes` is just like plotting -# with `~ultraplot.axes.CartesianAxes`. ultraplot makes longitude-latitude +# In UltraPlot, plotting with `~ultraplot.axes.GeoAxes` is just like plotting +# with `~ultraplot.axes.CartesianAxes`. UltraPlot makes longitude-latitude # (i.e., Plate Carrée) coordinates the *default* coordinate system for all plotting # commands by internally passing ``transform=ccrs.PlateCarree()`` to cartopy commands # and ``latlon=True`` to basemap commands. And again, when `basemap`_ is the backend, # plotting is done "cartopy-style" by calling methods from the `ultraplot.axes.GeoAxes` # instance rather than the `~mpl_toolkits.basemap.Basemap` instance. # -# To ensure that a 2D `~ultraplot.axes.PlotAxes` command like -# `~ultraplot.axes.PlotAxes.contour` or `~ultraplot.axes.PlotAxes.pcolor` +# To ensure that a 2D :class:`~ultraplot.axes.PlotAxes` command like +# :func:`~ultraplot.axes.PlotAxes.contour` or :func:`~ultraplot.axes.PlotAxes.pcolor` # fills the entire globe, simply pass ``globe=True`` to the command. # This interpolates the data to the North and South poles and across the longitude # seam before plotting. This is a convenient and succinct alternative to cartopy's -# `~cartopy.util.add_cyclic_point` and basemap's `~mpl_toolkits.basemap.addcyclic`. +# `~cartopy.util.add_cyclic_point` and basemap's :func:`~mpl_toolkits.basemap.addcyclic`. # # To draw content above or underneath a given geographic feature, simply change # the `zorder `__ @@ -329,7 +329,7 @@ # latitude gridline locations using the `grid`, `lonlocator`, `latlocator`, `gridminor`, # `lonminorlocator`, and `latminorlocator` keys, and configure gridline label formatting # with `lonformatter` and `latformatter` (analogous to `xlocator`, `xminorlocator`, -# and `xformatter` used by `ultraplot.axes.CartesianAxes.format`). By default, inline +# and `xformatter` used by :func:`ultraplot.axes.CartesianAxes.format`). By default, inline # cartopy labels and cartopy label rotation are turned off, but inline labels can # be turned on using ``loninline=True``, ``latinline=True``, or ``inlinelabels=True`` # or by setting :rcraw:`grid.inlinelabels` to ``True``, and label rotation can be @@ -341,10 +341,10 @@ # and latitudes with `lonlim` and `latlim` (analogous to `xlim` and `ylim`), set the # latitude bound for circular polar projections using `boundinglat`, and toggle and # configure geographic features like land masses, coastlines, and administrative -# borders using :ref:`settings ` like `land`, `landcolor`, `coast`, +# borders using :ref:`settings ` like `land`, `landcolor`, `coast`, # `coastcolor`, and `coastlinewidth`. Finally, since `ultraplot.axes.GeoAxes.format` # calls `ultraplot.axes.Axes.format`, it can be used to add axes titles, a-b-c labels, -# and figure titles, just like `ultraplot.axes.CartesianAxes.format`. +# and figure titles, just like :func:`ultraplot.axes.CartesianAxes.format`. # # For details, see the `ultraplot.axes.GeoAxes.format` documentation. @@ -423,21 +423,21 @@ # # To zoom into cartopy projections, use # `~cartopy.mpl.geoaxes.GeoAxes.set_extent` or pass `lonlim`, -# `latlim`, or `boundinglat` to `~ultraplot.axes.GeoAxes.format`. The `boundinglat` +# `latlim`, or `boundinglat` to :func:`~ultraplot.axes.GeoAxes.format`. The `boundinglat` # keyword controls the circular latitude boundary for North Polar and # South Polar Stereographic, Azimuthal Equidistant, Lambert Azimuthal -# Equal-Area, and Gnomonic projections. By default, ultraplot tries to use the +# Equal-Area, and Gnomonic projections. By default, UltraPlot tries to use the # degree-minute-second cartopy locators and formatters made available in cartopy # 0.18. You can switch from minute-second subintervals to traditional decimal -# subintervals by passing ``dms=False`` to `~ultraplot.axes.GeoAxes.format` +# subintervals by passing ``dms=False`` to :func:`~ultraplot.axes.GeoAxes.format` # or by setting :rcraw:`grid.dmslabels` to ``False``. # # To zoom into basemap projections, pass any of the `boundinglat`, # `llcrnrlon`, `llcrnrlat`, `urcrnrlon`, `urcrnrlat`, `llcrnrx`, `llcrnry`, # `urcrnrx`, `urcrnry`, `width`, or `height` keyword arguments to -# the `~ultraplot.constructor.Proj` constructor function either directly or via -# the `proj_kw` `~ultraplot.ui.subplots` keyword argument. You can also pass -# `lonlim` and `latlim` to `~ultraplot.constructor.Proj` and these arguments +# the :class:`~ultraplot.constructor.Proj` constructor function either directly or via +# the `proj_kw` :func:`~ultraplot.ui.subplots` keyword argument. You can also pass +# `lonlim` and `latlim` to :class:`~ultraplot.constructor.Proj` and these arguments # will be used for `llcrnrlon`, `llcrnrlat`, etc. You cannot zoom into basemap # projections with `format` after they have already been created. @@ -514,7 +514,7 @@ # plotted below. The full table of projection names with links to the relevant # `PROJ `__ documentation is found :ref:`here `. # -# ultraplot uses the cartopy API to add the Aitoff, Hammer, Winkel Tripel, and +# UltraPlot uses the cartopy API to add the Aitoff, Hammer, Winkel Tripel, and # Kavrayskiy VII projections (i.e., ``'aitoff'``, ``'hammer'``, ``'wintri'``, # and ``'kav7'``), as well as North and South polar versions of the Azimuthal # Equidistant, Lambert Azimuthal Equal-Area, and Gnomonic projections (i.e., diff --git a/docs/stats.py b/docs/stats.py index 245392c63..6303aac52 100644 --- a/docs/stats.py +++ b/docs/stats.py @@ -26,11 +26,11 @@ # # This section documents a few basic additions to matplotlib's plotting commands # that can be useful for statistical analysis. These features are implemented -# using the intermediate `~ultraplot.axes.PlotAxes` subclass (see the :ref:`1D plotting +# using the intermediate :class:`~ultraplot.axes.PlotAxes` subclass (see the :ref:`1D plotting # ` section for details). Some of these tools will be expanded in the # future, but for a more comprehensive suite of statistical plotting utilities, you # may be interested in `seaborn`_ (we try to ensure that seaborn plotting commands -# are compatible with ultraplot figures and axes). +# are compatible with UltraPlot figures and axes). # %% [raw] raw_mimetype="text/restructuredtext" # .. _ug_errorbars: @@ -39,11 +39,11 @@ # ---------------------- # # Error bars and error shading can be quickly added on-the-fly to -# `~ultraplot.axes.PlotAxes.line`, `~ultraplot.axes.PlotAxes.linex` -# (equivalently, `~ultraplot.axes.PlotAxes.plot`, -# `~ultraplot.axes.PlotAxes.plotx`), `~ultraplot.axes.PlotAxes.scatter`, -# `~ultraplot.axes.PlotAxes.scatterx`, `~ultraplot.axes.PlotAxes.bar`, and -# `~ultraplot.axes.PlotAxes.barh` plots using any of several keyword arguments. +# :func:`~ultraplot.axes.PlotAxes.line`, :func:`~ultraplot.axes.PlotAxes.linex` +# (equivalently, :func:`~ultraplot.axes.PlotAxes.plot`, +# :func:`~ultraplot.axes.PlotAxes.plotx`), :func:`~ultraplot.axes.PlotAxes.scatter`, +# :func:`~ultraplot.axes.PlotAxes.scatterx`, :func:`~ultraplot.axes.PlotAxes.bar`, and +# :func:`~ultraplot.axes.PlotAxes.barh` plots using any of several keyword arguments. # # If you pass 2D arrays to these commands with ``mean=True``, ``means=True``, # ``median=True``, or ``medians=True``, the means or medians of each column are @@ -55,7 +55,7 @@ # these bars (the ``box`` keywords; think of them as miniature boxplots), a # transparent primary shading region (the ``shade`` keywords), and a more # transparent secondary shading region (the ``fade`` keywords). See the -# documentation on the `~ultraplot.axes.PlotAxes` commands for details. +# documentation on the :class:`~ultraplot.axes.PlotAxes` commands for details. # %% @@ -153,14 +153,14 @@ # -------------------------- # # Vertical and horizontal box and violin plots can be drawn using -# `~ultraplot.axes.PlotAxes.boxplot`, `~ultraplot.axes.PlotAxes.violinplot`, -# `~ultraplot.axes.PlotAxes.boxploth`, and `~ultraplot.axes.PlotAxes.violinploth` (or -# their new shorthands, `~ultraplot.axes.PlotAxes.box`, `~ultraplot.axes.PlotAxes.violin`, -# `~ultraplot.axes.PlotAxes.boxh`, and `~ultraplot.axes.PlotAxes.violinh`). The -# ultraplot versions employ aesthetically pleasing defaults and permit flexible +# :func:`~ultraplot.axes.PlotAxes.boxplot`, :func:`~ultraplot.axes.PlotAxes.violinplot`, +# :func:`~ultraplot.axes.PlotAxes.boxploth`, and :func:`~ultraplot.axes.PlotAxes.violinploth` (or +# their new shorthands, :func:`~ultraplot.axes.PlotAxes.box`, :func:`~ultraplot.axes.PlotAxes.violin`, +# :func:`~ultraplot.axes.PlotAxes.boxh`, and :func:`~ultraplot.axes.PlotAxes.violinh`). The +# UltraPlot versions employ aesthetically pleasing defaults and permit flexible # configuration using keywords like `color`, `barcolor`, and `fillcolor`. -# They also automatically apply axis labels based on the `~pandas.DataFrame` -# or `~xarray.DataArray` column labels. Violin plot error bars are controlled +# They also automatically apply axis labels based on the :class:`~pandas.DataFrame` +# or :class:`~xarray.DataArray` column labels. Violin plot error bars are controlled # with the same keywords used for :ref:`on-the-fly error bars `. # %% @@ -203,21 +203,21 @@ # ----------------------------- # # Vertical and horizontal histograms can be drawn with -# `~ultraplot.axes.PlotAxes.hist` and `~ultraplot.axes.PlotAxes.histh`. -# As with the other 1D `~ultraplot.axes.PlotAxes` commands, multiple histograms +# :func:`~ultraplot.axes.PlotAxes.hist` and :func:`~ultraplot.axes.PlotAxes.histh`. +# As with the other 1D :class:`~ultraplot.axes.PlotAxes` commands, multiple histograms # can be drawn by passing 2D arrays instead of 1D arrays, and the color # cycle used to color histograms can be changed on-the-fly using # the `cycle` and `cycle_kw` keywords. Likewise, 2D histograms can -# be drawn with the `~ultraplot.axes.PlotAxes.hist2d` -# `~ultraplot.axes.PlotAxes.hexbin` commands, and their colormaps can +# be drawn with the :func:`~ultraplot.axes.PlotAxes.hist2d` +# :func:`~ultraplot.axes.PlotAxes.hexbin` commands, and their colormaps can # be changed on-the-fly with the `cmap` and `cmap_kw` keywords (see # the :ref:`2D plotting section `). Marginal distributions # for the 2D histograms can be added using :ref:`panel axes `. # -# In the future, ultraplot will include options for adding "smooth" kernel density +# In the future, UltraPlot will include options for adding "smooth" kernel density # estimations to histograms plots using a `kde` keyword. It will also include # separate `ultraplot.axes.PlotAxes.kde` and `ultraplot.axes.PlotAxes.kde2d` commands. -# The `~ultraplot.axes.PlotAxes.violin` and `~ultraplot.axes.PlotAxes.violinh` commands +# The :func:`~ultraplot.axes.PlotAxes.violin` and :func:`~ultraplot.axes.PlotAxes.violinh` commands # will use the same algorithm for kernel density estimation as the `kde` commands. # %% diff --git a/docs/subplots.py b/docs/subplots.py index ff2b6e180..4af633c74 100644 --- a/docs/subplots.py +++ b/docs/subplots.py @@ -18,23 +18,23 @@ # Subplots # ======== # -# This section documents a variety of features related to ultraplot subplots, +# This section documents a variety of features related to UltraPlot subplots, # including a-b-c subplot labels, axis sharing between subplots, automatic # "tight layout" spacing between subplots, and a unique feature where the figure # width and/or height are automatically adjusted based on the subplot geometry. # # .. note:: # -# ultraplot only supports one `~ultraplot.gridspec.GridSpec` per figure -# (see the section on :ref:`adding subplots `), and ultraplot +# UltraPlot only supports one :class:`~ultraplot.gridspec.GridSpec` per figure +# (see the section on :ref:`adding subplots `), and UltraPlot # does not officially support the "nested" matplotlib structures -# `~matplotlib.gridspec.GridSpecFromSubplotSpec` and `~matplotlib.figure.SubFigure`. +# :class:`~matplotlib.gridspec.GridSpecFromSubplotSpec` and :class:`~matplotlib.figure.SubFigure`. # These restrictions have the advantage of 1) considerably simplifying the # :ref:`tight layout ` and :ref:`figure size ` # algorithms and 2) reducing the ambiguity of :ref:`a-b-c label assignment ` # and :ref:`automatic axis sharing ` between subplots. If you need the # features associated with "nested" matplotlib structures, some are reproducible -# with ultraplot -- including :ref:`different spaces ` between distinct +# with UltraPlot -- including :ref:`different spaces ` between distinct # subplot rows and columns and :ref:`different formatting ` for # distinct groups of subplots. # @@ -45,23 +45,23 @@ # A-b-c labels # ------------ # -# ultraplot can quickly add "a-b-c" labels using the -# `~ultraplot.axes.Axes.number` assigned to each subplot. -# If you add subplots one-by-one with `~ultraplot.figure.Figure.add_subplot`, you can +# UltraPlot can quickly add "a-b-c" labels using the +# :func:`~ultraplot.axes.Axes.number` assigned to each subplot. +# If you add subplots one-by-one with :func:`~ultraplot.figure.Figure.add_subplot`, you can # manually specify the number with the `number` keyword. By default, the subplot number -# is incremented by ``1`` each time you call `~ultraplot.figure.Figure.add_subplot`. -# If you draw all of your subplots at once with `~ultraplot.figure.Figure.add_subplots`, +# is incremented by ``1`` each time you call :func:`~ultraplot.figure.Figure.add_subplot`. +# If you draw all of your subplots at once with :func:`~ultraplot.figure.Figure.add_subplots`, # the numbers depend on the input arguments. If you # :ref:`passed an array `, the subplot numbers correspond to the numbers # in the array. But if you used the `ncols` and `nrows` keyword arguments, the # number order is row-major by default and can be switched to column-major by # passing ``order='F'`` (note the number order also determines the list order in the -# `~ultraplot.gridspec.SubplotGrid` returned by `~ultraplot.figure.Figure.add_subplots`). +# :class:`~ultraplot.gridspec.SubplotGrid` returned by :func:`~ultraplot.figure.Figure.add_subplots`). # # To turn on "a-b-c" labels, set :rcraw:`abc` to ``True`` or pass ``abc=True`` -# to `~ultraplot.axes.Axes.format` (see :ref:`the format command ` +# to :func:`~ultraplot.axes.Axes.format` (see :ref:`the format command ` # for details). To change the label style, set :rcraw:`abc` to e.g. ``'A.'`` or -# pass e.g. ``abc='A.'`` to `~ultraplot.axes.Axes.format`. You can also modify +# pass e.g. ``abc='A.'`` to :func:`~ultraplot.axes.Axes.format`. You can also modify # the "a-b-c" label location, weight, and size with the :rcraw:`abc.loc`, # :rcraw:`abc.weight`, and :rcraw:`abc.size` settings. Also note that if the # an "a-b-c" label and title are in the same position, they are automatically @@ -117,19 +117,19 @@ # Figure width and height # ----------------------- # -# ultraplot automatically adjusts the figure width and height by default to +# UltraPlot automatically adjusts the figure width and height by default to # respect the physical size of a "reference" subplot and the geometry of the -# `~ultraplot.figure.Figure.gridspec`. The "reference" subplot is the subplot whose -# `~ultraplot.axes.Axes.number` matches the `refnum` that was passed to -# `~ultraplot.figure.Figure` (the default `refnum` of ``1`` usually matches the subplot +# :func:`~ultraplot.figure.Figure.gridspec`. The "reference" subplot is the subplot whose +# :func:`~ultraplot.axes.Axes.number` matches the `refnum` that was passed to +# :class:`~ultraplot.figure.Figure` (the default `refnum` of ``1`` usually matches the subplot # in the upper-left corner -- see :ref:`this section ` for more on subplot # numbers). Alternatively, you can request a fixed figure width (height), and the # algorithm will automatically adjusts the figure height (width) to respect -# the `~ultraplot.figure.Figure.gridspec` geometry. +# the :func:`~ultraplot.figure.Figure.gridspec` geometry. # This algorithm is extremely powerful and generally produces more aesthetically # pleasing subplot grids out-of-the-box, especially when they contain images or map -# projections (see below). It is constrained by the following `~ultraplot.figure.Figure` +# projections (see below). It is constrained by the following :class:`~ultraplot.figure.Figure` # keyword arguments: # # * `refwidth` and `refheight` set the physical width and height of the reference @@ -163,19 +163,19 @@ # * If the `data aspect ratio # `__ # of the reference subplot is fixed (either due to calling -# `~matplotlib.axes.Axes.set_aspect` or filling the subplot with a -# :ref:`geographic projection `, `~ultraplot.axes.PlotAxes.imshow` -# plot, or `~ultraplot.axes.PlotAxes.heatmap` plot), then this is used as +# :func:`~matplotlib.axes.Axes.set_aspect` or filling the subplot with a +# :ref:`geographic projection `, :func:`~ultraplot.axes.PlotAxes.imshow` +# plot, or :func:`~ultraplot.axes.PlotAxes.heatmap` plot), then this is used as # the default value for the reference aspect ratio `refaspect`. This helps # minimize excess space between grids of subplots with fixed aspect ratios. # * For the simplest subplot grids (e.g., those created by passing integers to -# `~ultraplot.figure.Figure.add_subplot` or passing `ncols` or `nrows` to -# `~ultraplot.figure.Figure.add_subplots`) the keyword arguments `refaspect`, +# :func:`~ultraplot.figure.Figure.add_subplot` or passing `ncols` or `nrows` to +# :func:`~ultraplot.figure.Figure.add_subplots`) the keyword arguments `refaspect`, # `refwidth`, and `refheight` effectively apply to every subplot in the # figure -- not just the reference subplot. -# * The physical widths of ultraplot `~ultraplot.axes.Axes.colorbar`\ s and -# `~ultraplot.axes.Axes.panel`\ s are always independent of the figure size. -# `~ultraplot.gridspec.GridSpec` specifies their widths in physical units to help +# * The physical widths of UltraPlot :func:`~ultraplot.axes.Axes.colorbar`\ s and +# :func:`~ultraplot.axes.Axes.panel`\ s are always independent of the figure size. +# :class:`~ultraplot.gridspec.GridSpec` specifies their widths in physical units to help # users avoid drawing colorbars and panels that look "too skinny" or "too fat" # depending on the number of subplots in the figure. @@ -234,17 +234,17 @@ # Spacing and tight layout # ------------------------ # -# ultraplot automatically adjusts the spacing between subplots +# UltraPlot automatically adjusts the spacing between subplots # by default to accomadate labels using its own `"tight layout" algorithm # `__. -# In contrast to matplotlib's algorithm, ultraplot's algorithm can :ref:`change the +# In contrast to matplotlib's algorithm, UltraPlot's algorithm can :ref:`change the # figure size ` and permits variable spacing between each subplot # row and column (see `ultraplot.gridspec.GridSpec` for details). # This algorithm can be disabled entirely by passing ``tight=False`` to -# `~ultraplot.figure.Figure` or by setting :rcraw:`subplots.tight` to ``False``, or +# :class:`~ultraplot.figure.Figure` or by setting :rcraw:`subplots.tight` to ``False``, or # it can be partly overridden by passing any of the spacing arguments `left`, `right`, -# `top`, `bottom`, `wspace`, or `hspace` to `~ultraplot.figure.Figure` or -# `~ultraplot.gridspec.GridSpec`. For example: +# `top`, `bottom`, `wspace`, or `hspace` to :class:`~ultraplot.figure.Figure` or +# :class:`~ultraplot.gridspec.GridSpec`. For example: # # * ``left=2`` fixes the left margin at 2 em-widths, while the right, # bottom, and top margin widths are determined by the tight layout algorithm. @@ -256,14 +256,14 @@ # # The padding between the tight layout extents (rather than the absolute spaces # between subplot edges) can also be changed by passing `outerpad`, `innerpad`, -# or `panelpad` to `~ultraplot.figure.Figure` or `~ultraplot.gridspec.GridSpec`. +# or `panelpad` to :class:`~ultraplot.figure.Figure` or :class:`~ultraplot.gridspec.GridSpec`. # This padding can be set locally by passing an array of values to `wpad` # and `hpad` (analogous to `wspace` and `hspace`), or by passing the `pad` # keyword when creating :ref:`panel axes ` or :ref:`outer # colorbars or legends ` (analogous to `space`). # # All the subplot spacing arguments can be specified with a -# :ref:`unit string ` interpreted by `~ultraplot.utils.units`. +# :ref:`unit string ` interpreted by :func:`~ultraplot.utils.units`. # The default unit assumed for numeric arguments is an "em-width" (i.e., a # :rcraw:`font.size` width -- see the :ref:`units table ` for details). # @@ -354,19 +354,19 @@ # Figures with lots of subplots often have :ref:`redundant labels `. # To help address this, the matplotlib command `matplotlib.pyplot.subplots` includes # `sharex` and `sharey` keywords that permit sharing axis limits and ticks between -# like rows and columns of subplots. ultraplot builds on this feature by: +# like rows and columns of subplots. UltraPlot builds on this feature by: # # #. Automatically sharing axes between subplots and :ref:`panels ` -# occupying the same rows or columns of the `~ultraplot.gridspec.GridSpec`. This +# occupying the same rows or columns of the :class:`~ultraplot.gridspec.GridSpec`. This # works for :ref:`aribtrarily complex subplot grids `. It also works -# for subplots generated one-by-one with `~ultraplot.figure.Figure.add_subplot` -# rather than `~ultraplot.figure.Figure.subplots`. It is controlled by the `sharex` -# and `sharey` `~ultraplot.figure.Figure` keywords (default is :rc:`subplots.share`). +# for subplots generated one-by-one with :func:`~ultraplot.figure.Figure.add_subplot` +# rather than :func:`~ultraplot.figure.Figure.subplots`. It is controlled by the `sharex` +# and `sharey` :class:`~ultraplot.figure.Figure` keywords (default is :rc:`subplots.share`). # Use the `share` keyword as a shorthand to set both `sharex` and `sharey`. # #. Automatically sharing labels across subplots and :ref:`panels ` -# with edges along the same row or column of the `~ultraplot.gridspec.GridSpec`. +# with edges along the same row or column of the :class:`~ultraplot.gridspec.GridSpec`. # This also works for complex subplot grids and subplots generated one-by-one. -# It is controlled by the `spanx` and `spany` `~ultraplot.figure.Figure` +# It is controlled by the `spanx` and `spany` :class:`~ultraplot.figure.Figure` # keywords (default is :rc:`subplots.span`). Use the `span` keyword # as a shorthand to set both `spanx` and `spany`. Note that unlike # `~matplotlib.figure.Figure.supxlabel` and `~matplotlib.figure.Figure.supylabel`, @@ -453,17 +453,17 @@ # Physical units # -------------- # -# ultraplot supports arbitrary physical units for controlling the figure +# UltraPlot supports arbitrary physical units for controlling the figure # `figwidth` and `figheight`; the reference subplot `refwidth` and `refheight`; # the gridspec spacing and tight layout padding keywords `left`, `right`, `bottom`, # `top`, `wspace`, `hspace`, `outerpad`, `innerpad`, `panelpad`, `wpad`, and `hpad`; -# the `~ultraplot.axes.Axes.colorbar` and `~ultraplot.axes.Axes.panel` widths; -# various `~ultraplot.axes.Axes.legend` spacing and padding arguments; various -# `~ultraplot.axes.Axes.format` font size and padding arguments; the line width and -# marker size arguments passed to `~ultraplot.axes.PlotAxes` commands; and all -# applicable `~ultraplot.config.rc` settings, e.g. :rcraw:`subplots.refwidth`, +# the :func:`~ultraplot.axes.Axes.colorbar` and :func:`~ultraplot.axes.Axes.panel` widths; +# various :func::class:`~ultraplot.axes.Axes.legend` spacing and padding arguments; various +# :func:`~ultraplot.axes.Axes.format` font size and padding arguments; the line width and +# marker size arguments passed to :class:`~ultraplot.axes.PlotAxes` commands; and all +# applicable :func:`~ultraplot.config.rc` settings, e.g. :rcraw:`subplots.refwidth`, # :rcraw:`legend.columnspacing`, and :rcraw:`axes.labelpad`. This feature is -# powered by the physical units engine `~ultraplot.utils.units`. +# powered by the physical units engine :func:`~ultraplot.utils.units`. # # When one of these keyword arguments is numeric, a default physical unit is # used. For subplot and figure sizes, the defult unit is inches. For gridspec and diff --git a/docs/usage.rst b/docs/usage.rst index 8713b8e3c..133a7f9d0 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -11,50 +11,50 @@ .. _usage: ============= -Using ultraplot +Using UltraPlot ============= -This page offers a condensed overview of ultraplot's features. It is populated +This page offers a condensed overview of UltraPlot's features. It is populated with links to the :ref:`API reference` and :ref:`User Guide `. -For a more in-depth discussion, see :ref:`Why ultraplot?`. +For a more in-depth discussion, see :ref:`Why UltraPlot?`. .. _usage_background: Background ========== -ultraplot is an object-oriented matplotlib wrapper. The "wrapper" part means -that ultraplot's features are largely a *superset* of matplotlib. You can use -plotting commands like `~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`, +UltraPlot is an object-oriented matplotlib wrapper. The "wrapper" part means +that UltraPlot's features are largely a *superset* of matplotlib. You can use +plotting commands like :func:`~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`, `~matplotlib.axes.Axes.contour`, and `~matplotlib.axes.Axes.pcolor` like you always -have. The "object-oriented" part means that ultraplot's features are implemented with -*subclasses* of the `~matplotlib.figure.Figure` and `~matplotlib.axes.Axes` classes. +have. The "object-oriented" part means that UltraPlot's features are implemented with +*subclasses* of the :class:`~matplotlib.figure.Figure` and :class:`~matplotlib.axes.Axes` classes. If you tend to use `~matplotlib.pyplot` and are not familiar with the figure and axes classes, check out `this guide `__. Directly working with matplotlib classes tends to be more clear and concise than `~matplotlib.pyplot`, makes things easier when working with multiple figures and axes, and is certainly more "`pythonic `__". -Therefore, although many ultraplot features may still work, we do not officially +Therefore, although many UltraPlot features may still work, we do not officially support the `~matplotlib.pyplot` interface. .. _usage_import: -Importing ultraplot +Importing UltraPlot ================= -Importing ultraplot immediately adds several +Importing UltraPlot immediately adds several new :ref:`colormaps `, :ref:`property cycles `, :ref:`color names `, and :ref:`fonts ` to matplotlib. If you are only interested in these features, you may want to -import ultraplot at the top of your script and do nothing else! -We recommend importing ultraplot as follows: +import UltraPlot at the top of your script and do nothing else! +We recommend importing UltraPlot as follows: .. code-block:: python import ultraplot as uplt -This differentiates ultraplot from the usual ``plt`` abbreviation reserved for +This differentiates UltraPlot from the usual ``plt`` abbreviation reserved for the `~matplotlib.pyplot` module. .. _usage_classes: @@ -62,7 +62,7 @@ the `~matplotlib.pyplot` module. Figure and axes classes ======================= -Creating figures with ultraplot is very similar to +Creating figures with UltraPlot is very similar to matplotlib. You can either create the figure and all of its subplots at once: @@ -83,7 +83,7 @@ then fill it with subplots: These commands are modeled after `matplotlib.pyplot.subplots` and `matplotlib.pyplot.figure` and are :ref:`packed with new features `. -One highlight is the `~ultraplot.figure.Figure.auto_layout` algorithm that +One highlight is the :func:`~ultraplot.figure.Figure.auto_layout` algorithm that :ref:`automatically adjusts the space between subplots ` (similar to matplotlib's `tight layout `__) @@ -93,10 +93,10 @@ and images). All sizing arguments take :ref:`arbitrary units `, including metric units like ``cm`` and ``mm``. Instead of the native `matplotlib.figure.Figure` and `matplotlib.axes.Axes` -classes, ultraplot uses the `ultraplot.figure.Figure`, `ultraplot.axes.Axes`, and -`ultraplot.axes.PlotAxes` subclasses. ultraplot figures are saved with -`~ultraplot.figure.Figure.save` or `~matplotlib.figure.Figure.savefig`, -and ultraplot axes belong to one of the following three child classes: +classes, UltraPlot uses the `ultraplot.figure.Figure`, `ultraplot.axes.Axes`, and +`ultraplot.axes.PlotAxes` subclasses. UltraPlot figures are saved with +:func:`~ultraplot.figure.Figure.save` or `~matplotlib.figure.Figure.savefig`, +and UltraPlot axes belong to one of the following three child classes: * `ultraplot.axes.CartesianAxes`: For ordinary plots with *x* and *y* coordinates. @@ -105,7 +105,7 @@ and ultraplot axes belong to one of the following three child classes: * `ultraplot.axes.PolarAxes`: For polar plots with *azimuth* and *radius* coordinates. -Most of ultraplot's features are implemented using these subclasses. +Most of UltraPlot's features are implemented using these subclasses. They include several new figure and axes methods and added functionality to existing figure and axes methods. @@ -117,17 +117,17 @@ functionality to existing figure and axes methods. :ref:`geographic plots `, and :ref:`polar plots `. * The `ultraplot.axes.Axes.colorbar` and `ultraplot.axes.Axes.legend` commands draw colorbars and legends inside of subplots or along the outside edges of - subplots. The `ultraplot.figure.Figure.colorbar` and `ultraplot.figure.Figure.legend` + subplots. The `ultraplot.figure.Figure.colorbar` and :class:`ultraplot.figure.Figure.legend` commands draw colorbars or legends along the edges of figures (aligned by subplot boundaries). These commands considerably :ref:`simplify ` the process of drawing colorbars and legends. -* The `ultraplot.axes.PlotAxes` subclass (used for all ultraplot axes) +* The `ultraplot.axes.PlotAxes` subclass (used for all UltraPlot axes) adds many, many useful features to virtually every plotting command - (including `~ultraplot.axes.PlotAxes.plot`, `~ultraplot.axes.PlotAxes.scatter`, - `~ultraplot.axes.PlotAxes.bar`, `~ultraplot.axes.PlotAxes.area`, - `~ultraplot.axes.PlotAxes.box`, `~ultraplot.axes.PlotAxes.violin`, - `~ultraplot.axes.PlotAxes.contour`, `~ultraplot.axes.PlotAxes.pcolor`, - and `~ultraplot.axes.PlotAxes.imshow`). See the :ref:`1D plotting ` + (including :func:`~ultraplot.axes.PlotAxes.plot`, :func:`~ultraplot.axes.PlotAxes.scatter`, + :func:`~ultraplot.axes.PlotAxes.bar`, :func:`~ultraplot.axes.PlotAxes.area`, + :func:`~ultraplot.axes.PlotAxes.box`, :func:`~ultraplot.axes.PlotAxes.violin`, + :func:`~ultraplot.axes.PlotAxes.contour`, :func:`~ultraplot.axes.PlotAxes.pcolor`, + and :func:`~ultraplot.axes.PlotAxes.imshow`). See the :ref:`1D plotting ` and :ref:`2D plotting ` sections for details. .. _usage_integration: @@ -135,7 +135,7 @@ functionality to existing figure and axes methods. Integration features ==================== -ultraplot includes *optional* integration features with four external +UltraPlot includes *optional* integration features with four external packages: the `pandas`_ and `xarray`_ packages, used for working with annotated tables and arrays, and the `cartopy`_ and `basemap`_ geographic plotting packages. @@ -146,7 +146,7 @@ plotting packages. :ref:`format projections `. `~ultraplot.axes.GeoAxes` provides provides a simpler, cleaner interface than the original `cartopy`_ and `basemap`_ interfaces. Figures can be filled with `~ultraplot.axes.GeoAxes` by passing the - `proj` keyword to `~ultraplot.ui.subplots`. + `proj` keyword to :func:`~ultraplot.ui.subplots`. * If you pass a `pandas.Series`, `pandas.DataFrame`, or `xarray.DataArray` to any plotting command, the axis labels, tick labels, titles, colorbar labels, and legend labels are automatically applied from the metadata. If @@ -156,7 +156,7 @@ plotting packages. ` and :ref:`2D plotting ` for a demonstration. Since these features are optional, -ultraplot can be used without installing any of these packages. +UltraPlot can be used without installing any of these packages. .. _usage_features: @@ -164,40 +164,40 @@ Additional features =================== Outside of the features provided by the `ultraplot.figure.Figure` and -`ultraplot.axes.Axes` subclasses, ultraplot includes several useful +`ultraplot.axes.Axes` subclasses, UltraPlot includes several useful classes and :ref:`constructor functions `. -* The `~ultraplot.constructor.Colormap` and `~ultraplot.constructor.Cycle` +* The :class:`~ultraplot.constructor.Colormap` and :class:`~ultraplot.constructor.Cycle` constructor functions can be used to :ref:`slice `, and :ref:`merge ` existing colormaps and color cycles. It can also :ref:`make new colormaps ` and :ref:`color cycles ` from scratch. -* The `~ultraplot.colors.ContinuousColormap` and - `~ultraplot.colors.DiscreteColormap` subclasses replace the default matplotlib +* The :class:`~ultraplot.colors.ContinuousColormap` and + :class:`~ultraplot.colors.DiscreteColormap` subclasses replace the default matplotlib colormap classes and add several methods. The new - `~ultraplot.colors.PerceptualColormap` class is used to make + :class:`~ultraplot.colors.PerceptualColormap` class is used to make colormaps with :ref:`perceptually uniform transitions `. -* The `~ultraplot.demos.show_cmaps`, `~ultraplot.demos.show_cycles`, - `~ultraplot.demos.show_colors`, `~ultraplot.demos.show_fonts`, - `~ultraplot.demos.show_channels`, and `~ultraplot.demos.show_colorspaces` +* The :func:`~ultraplot.demos.show_cmaps`, :func:`~ultraplot.demos.show_cycles`, + :func:`~ultraplot.demos.show_colors`, :func:`~ultraplot.demos.show_fonts`, + :func:`~ultraplot.demos.show_channels`, and :func:`~ultraplot.demos.show_colorspaces` functions are used to visualize your :ref:`color scheme ` and :ref:`font options ` and :ref:`inspect individual colormaps `. -* The `~ultraplot.constructor.Norm` constructor function generates colormap +* The :class:`~ultraplot.constructor.Norm` constructor function generates colormap normalizers from shorthand names. The new `~ultraplot.colors.SegmentedNorm` normalizer scales colors evenly w.r.t. index for arbitrarily spaced monotonic levels, and the new `~ultraplot.colors.DiscreteNorm` meta-normalizer is used to :ref:`break up colormap colors into discrete levels `. -* The `~ultraplot.constructor.Locator`, `~ultraplot.constructor.Formatter`, and - `~ultraplot.constructor.Scale` constructor functions return corresponding class +* The :class:`~ultraplot.constructor.Locator`, :class:`~ultraplot.constructor.Formatter`, and + :class:`~ultraplot.constructor.Scale` constructor functions return corresponding class instances from flexible input types. These are used to interpret keyword - arguments passed to `~ultraplot.axes.Axes.format`, and can be used to quickly + arguments passed to :func:`~ultraplot.axes.Axes.format`, and can be used to quickly and easily modify :ref:`x and y axis settings `. -* The `~ultraplot.config.rc` object, an instance of - `~ultraplot.config.Configurator`, is used for +* The :func:`~ultraplot.config.rc` object, an instance of + :class:`~ultraplot.config.Configurator`, is used for :ref:`modifying individual settings, changing settings in bulk, and temporarily changing settings in context blocks `. It also introduces several :ref:`new setings ` - and sets up the inline plotting backend with `~ultraplot.config.inline_backend_fmt` + and sets up the inline plotting backend with :func:`~ultraplot.config.inline_backend_fmt` so that your inline figures look the same as your saved figures. diff --git a/docs/why.rst b/docs/why.rst index 3a3c8cf71..42358b901 100644 --- a/docs/why.rst +++ b/docs/why.rst @@ -31,7 +31,7 @@ .. _why: ============ -Why ultraplot? +Why UltraPlot? ============ Matplotlib is an extremely versatile plotting package used by @@ -42,9 +42,9 @@ matplotlib can be cumbersome or repetitive for users who... * Want to finely tune their annotations and aesthetics. * Need to make new figures nearly every day. -ultraplot's core mission is to provide a smoother plotting experience for +UltraPlot's core mission is to provide a smoother plotting experience for matplotlib's most demanding users. We accomplish this by *expanding upon* -matplotlib's :ref:`object-oriented interface `. ultraplot +matplotlib's :ref:`object-oriented interface `. UltraPlot makes changes that would be hard to justify or difficult to incorporate into matplotlib itself, owing to differing design choices and backwards compatibility considerations. @@ -67,12 +67,12 @@ the default interface, this requires calling a series of one-liner setter method This workflow is quite verbose -- it tends to require "boilerplate code" that gets copied and pasted a hundred times. It can also be confusing -- it is -often unclear whether properties are applied from an `~matplotlib.axes.Axes` +often unclear whether properties are applied from an :class:`~matplotlib.axes.Axes` setter (e.g. `~matplotlib.axes.Axes.set_xlabel` and `~matplotlib.axes.Axes.set_xticks`), an `~matplotlib.axis.XAxis` or `~matplotlib.axis.YAxis` setter (e.g. `~matplotlib.axis.Axis.set_major_locator` and -`~matplotlib.axis.Axis.set_major_formatter`), a `~matplotlib.spines.Spine` +`~matplotlib.axis.Axis.set_major_formatter`), a :class:`~matplotlib.spines.Spine` setter (e.g. `~matplotlib.spines.Spine.set_bounds`), or a "bulk" property setter (e.g. `~matplotlib.axes.Axes.tick_params`), or whether one must dig into the figure architecture and apply settings to several different objects. @@ -82,14 +82,14 @@ settings without sacrificing the advantages of object-oriented design. Changes ------- -ultraplot includes the `ultraplot.axes.Axes.format` command to resolve this. +UltraPlot includes the `ultraplot.axes.Axes.format` command to resolve this. Think of this as an expanded and thoroughly documented version of the -`matplotlib.artist.Artist.update` command. `~ultraplot.axes.Axes.format` can modify things +`matplotlib.artist.Artist.update` command. :func:`~ultraplot.axes.Axes.format` can modify things like axis labels and titles and apply new :ref:`"rc" settings ` to existing axes. It also integrates with various :ref:`constructor functions ` to help keep things succinct. Further, the `ultraplot.figure.Figure.format` and `ultraplot.gridspec.SubplotGrid.format` commands can be used to -`~ultraplot.axes.Axes.format` several subplots at once. +:func:`~ultraplot.axes.Axes.format` several subplots at once. Together, these features significantly reduce the amount of code needed to create highly customized figures. As an example, it is trivial to see that... @@ -124,7 +124,7 @@ Links * For an introduction, see :ref:`this page `. * For `~ultraplot.axes.CartesianAxes` formatting, see :ref:`this page `. -* For `~ultraplot.axes.PolarAxes` formatting, +* For :class:`~ultraplot.axes.PolarAxes` formatting, see :ref:`this page `. * For `~ultraplot.axes.GeoAxes` formatting, see :ref:`this page `. @@ -158,17 +158,17 @@ So, why not "register" everything else? Changes ------- -In ultraplot, tick locators, tick formatters, axis scales, property cycles, colormaps, +In UltraPlot, tick locators, tick formatters, axis scales, property cycles, colormaps, normalizers, and `cartopy`_ projections are all "registered". This is accomplished by defining "constructor functions" and passing various keyword arguments through these functions. The constructor functions also accept intuitive inputs alongside "registered" -names. For example, a scalar passed to `~ultraplot.constructor.Locator` +names. For example, a scalar passed to :class:`~ultraplot.constructor.Locator` returns a `~matplotlib.ticker.MultipleLocator`, a -lists of strings passed to `~ultraplot.constructor.Formatter` returns a -`~matplotlib.ticker.FixedFormatter`, and `~ultraplot.constructor.Cycle` -and `~ultraplot.constructor.Colormap` accept colormap names, individual colors, and +lists of strings passed to :class:`~ultraplot.constructor.Formatter` returns a +`~matplotlib.ticker.FixedFormatter`, and :class:`~ultraplot.constructor.Cycle` +and :class:`~ultraplot.constructor.Colormap` accept colormap names, individual colors, and lists of colors. Passing the relevant class instance to a constructor function simply returns it, and all the registered classes are available in the top-level namespace -- so class instances can be directly created with e.g. @@ -180,13 +180,13 @@ The below table lists the constructor functions and the keyword arguments that u ================================ ============================================================ ============================================================================== ================================================================================================================================================================================================ Function Return type Used by Keyword argument(s) ================================ ============================================================ ============================================================================== ================================================================================================================================================================================================ -`~ultraplot.constructor.Proj` `~cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap` `~ultraplot.figure.Figure.add_subplot` and `~ultraplot.figure.Figure.add_subplots` ``proj=`` -`~ultraplot.constructor.Locator` `~matplotlib.ticker.Locator` `~ultraplot.axes.Axes.format` and `~ultraplot.axes.Axes.colorbar` ``locator=``, ``xlocator=``, ``ylocator=``, ``minorlocator=``, ``xminorlocator=``, ``yminorlocator=``, ``ticks=``, ``xticks=``, ``yticks=``, ``minorticks=``, ``xminorticks=``, ``yminorticks=`` -`~ultraplot.constructor.Formatter` `~matplotlib.ticker.Formatter` `~ultraplot.axes.Axes.format` and `~ultraplot.axes.Axes.colorbar` ``formatter=``, ``xformatter=``, ``yformatter=``, ``ticklabels=``, ``xticklabels=``, ``yticklabels=`` -`~ultraplot.constructor.Scale` `~matplotlib.scale.ScaleBase` `~ultraplot.axes.Axes.format` ``xscale=``, ``yscale=`` -`~ultraplot.constructor.Colormap` `~matplotlib.colors.Colormap` 2D `~ultraplot.axes.PlotAxes` commands ``cmap=`` -`~ultraplot.constructor.Norm` `~matplotlib.colors.Normalize` 2D `~ultraplot.axes.PlotAxes` commands ``norm=`` -`~ultraplot.constructor.Cycle` `~cycler.Cycler` 1D `~ultraplot.axes.PlotAxes` commands ``cycle=`` +:class:`~ultraplot.constructor.Proj` `~cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap` :func:`~ultraplot.figure.Figure.add_subplot` and :func:`~ultraplot.figure.Figure.add_subplots` ``proj=`` +:class:`~ultraplot.constructor.Locator` :class:`~matplotlib.ticker.Locator` :func:`~ultraplot.axes.Axes.format` and :func:`~ultraplot.axes.Axes.colorbar` ``locator=``, ``xlocator=``, ``ylocator=``, ``minorlocator=``, ``xminorlocator=``, ``yminorlocator=``, ``ticks=``, ``xticks=``, ``yticks=``, ``minorticks=``, ``xminorticks=``, ``yminorticks=`` +:class:`~ultraplot.constructor.Formatter` :class:`~matplotlib.ticker.Formatter` :func:`~ultraplot.axes.Axes.format` and :func:`~ultraplot.axes.Axes.colorbar` ``formatter=``, ``xformatter=``, ``yformatter=``, ``ticklabels=``, ``xticklabels=``, ``yticklabels=`` +:class:`~ultraplot.constructor.Scale` `~matplotlib.scale.ScaleBase` :func:`~ultraplot.axes.Axes.format` ``xscale=``, ``yscale=`` +:class:`~ultraplot.constructor.Colormap` :class:`~matplotlib.colors.Colormap` 2D :class:`~ultraplot.axes.PlotAxes` commands ``cmap=`` +:class:`~ultraplot.constructor.Norm` :class:`~matplotlib.colors.Normalize` 2D :class:`~ultraplot.axes.PlotAxes` commands ``norm=`` +:class:`~ultraplot.constructor.Cycle` :class:`~cycler.Cycler` 1D :class:`~ultraplot.axes.PlotAxes` commands ``cycle=`` ================================ ============================================================ ============================================================================== ================================================================================================================================================================================================ Links @@ -244,14 +244,14 @@ column boundaries. Changes ------- -By default, ultraplot fixes the physical dimensions of a *reference subplot* rather +By default, UltraPlot fixes the physical dimensions of a *reference subplot* rather than the figure. The reference subplot dimensions are controlled with the `refwidth`, -`refheight`, and `refaspect` `~ultraplot.figure.Figure` keywords, with a default +`refheight`, and `refaspect` :class:`~ultraplot.figure.Figure` keywords, with a default behavior of ``refaspect=1`` and ``refwidth=2.5`` (inches). If the `data aspect ratio `__ of the reference subplot is fixed (as with :ref:`geographic `, :ref:`polar `, `~matplotlib.axes.Axes.imshow`, and -`~ultraplot.axes.Axes.heatmap` plots) then this is used instead of `refaspect`. +:func:`~ultraplot.axes.Axes.heatmap` plots) then this is used instead of `refaspect`. Alternatively, you can independently specify the width or height of the *figure* with the `figwidth` and `figheight` parameters. If only one is specified, the @@ -260,7 +260,7 @@ when preparing figures for submission to a publication. To request figure dimensions suitable for submission to a :ref:`specific publication `, use the `journal` keyword. -By default, ultraplot also uses :ref:`its own tight layout algorithm ` -- +By default, UltraPlot also uses :ref:`its own tight layout algorithm ` -- preventing text labels from overlapping with subplots. This algorithm works with the `ultraplot.gridspec.GridSpec` subclass rather than `matplotlib.gridspec.GridSpec`, which provides the following advantages: @@ -280,13 +280,13 @@ provides the following advantages: * You can :ref:`override ` particular spacing parameters and leave the tight layout algorithm to adjust the unspecified spacing parameters. For example, passing ``right=1`` to - `~ultraplot.figure.Figure.add_subplots` fixes the right margin + :func:`~ultraplot.figure.Figure.add_subplots` fixes the right margin at 1 font size-width while the others are adjusted automatically. * Only one `ultraplot.gridspec.GridSpec` is permitted per figure, considerably simplifying the tight layout algorithm calculations. This restriction is enforced by requiring successive - `~ultraplot.figure.Figure.add_subplot` calls to imply the same geometry and - include only subplot specs generated from the same `~ultraplot.gridspec.GridSpec`. + :func:`~ultraplot.figure.Figure.add_subplot` calls to imply the same geometry and + include only subplot specs generated from the same :class:`~ultraplot.gridspec.GridSpec`. Links ----- @@ -318,29 +318,29 @@ matplotlib has no built-in way of doing this. Changes ------- -ultraplot makes it easier to work with multiple subplots and create clear, +UltraPlot makes it easier to work with multiple subplots and create clear, concise figures. * Axis tick labels and axis labels are automatically :ref:`shared and aligned ` between subplot in the same - `~ultraplot.gridspec.GridSpec` row or column. This is controlled by the `sharex`, + :class:`~ultraplot.gridspec.GridSpec` row or column. This is controlled by the `sharex`, `sharey`, `spanx`, `spany`, `alignx`, and `aligny` figure keywords. -* The figure `ultraplot.figure.Figure.colorbar` and `ultraplot.figure.Figure.legend` +* The figure `ultraplot.figure.Figure.colorbar` and :class:`ultraplot.figure.Figure.legend` commands can easily draw colorbars and legends intended to reference more than one subplot in arbitrary contiguous rows and columns. See the :ref:`next section ` for details. * A-b-c labels can be added to subplots simply using the :rcraw:`abc` setting -- for example, ``uplt.rc['abc'] = 'A.'`` or ``axs.format(abc='A.')``. - This is possible because `~ultraplot.figure.Figure.add_subplot` assigns a unique - `~ultraplot.axes.Axes.number` to every new subplot. + This is possible because :func:`~ultraplot.figure.Figure.add_subplot` assigns a unique + :func:`~ultraplot.axes.Axes.number` to every new subplot. * The `ultraplot.gridspec.SubplotGrid.format` command can easily format multiple subplots at once or add colorbars, legends, panels, twin axes, or inset axes to multiple - subplots at once. A `~ultraplot.gridspec.SubplotGrid` is returned by + subplots at once. A :class:`~ultraplot.gridspec.SubplotGrid` is returned by `ultraplot.figure.Figure.subplots`, and can be indexed like a list or a 2D array. -* The `~ultraplot.axes.Axes.panel_axes` (shorthand `~ultraplot.axes.Axes.panel`) commands +* The :func:`~ultraplot.axes.Axes.panel_axes` (shorthand :func:`~ultraplot.axes.Axes.panel`) commands draw :ref:`thin panels ` along the edges of subplots. This can be useful for plotting 1D summary statistics alongside 2D plots. You can also add twin axes and - panel axes to several subplots at once using `~ultraplot.gridspec.SubplotGrid` commands. + panel axes to several subplots at once using :class:`~ultraplot.gridspec.SubplotGrid` commands. Links ----- @@ -372,7 +372,7 @@ with consistent widths (i.e., not too "skinny" or "fat"). Changes ------- -ultraplot includes a simple framework for drawing colorbars and legends +UltraPlot includes a simple framework for drawing colorbars and legends that reference :ref:`individual subplots ` and :ref:`multiple contiguous subplots `. @@ -383,16 +383,16 @@ that reference :ref:`individual subplots ` and "inner" location (e.g. ``loc='ur'`` or ``loc='upper right'``) to `ultraplot.axes.Axes.colorbar` or `ultraplot.axes.Axes.legend`. * To draw a colorbar or legend along the edge of the figure, use - `ultraplot.figure.Figure.colorbar` and `ultraplot.figure.Figure.legend`. + `ultraplot.figure.Figure.colorbar` and :class:`ultraplot.figure.Figure.legend`. The `col`, `row`, and `span` keywords control which - `~ultraplot.gridspec.GridSpec` rows and columns are spanned + :class:`~ultraplot.gridspec.GridSpec` rows and columns are spanned by the colorbar or legend. -Since `~ultraplot.gridspec.GridSpec` permits variable spacing between subplot +Since :class:`~ultraplot.gridspec.GridSpec` permits variable spacing between subplot rows and columns, "outer" colorbars and legends do not alter subplot spacing or add whitespace. This is critical e.g. if you have a colorbar between columns 1 and 2 but nothing between columns 2 and 3. -Also, `~ultraplot.figure.Figure` and `~ultraplot.axes.Axes` colorbar widths are +Also, :class:`~ultraplot.figure.Figure` and :class:`~ultraplot.axes.Axes` colorbar widths are now specified in *physical* units rather than relative units, which makes colorbar thickness independent of subplot size and easier to get just right. @@ -423,101 +423,101 @@ have this functionality built right into matplotlib's interface. Changes ------- -ultraplot uses the `~ultraplot.axes.PlotAxes` subclass to add various `seaborn`_, +UltraPlot uses the :class:`~ultraplot.axes.PlotAxes` subclass to add various `seaborn`_, `xarray`_, and `pandas`_ features to existing matplotlib plotting commands along with several additional features designed to make things easier. -The following features are relevant for "1D" `~ultraplot.axes.PlotAxes` commands -like `~ultraplot.axes.PlotAxes.line` (equivalent to `~ultraplot.axes.PlotAxes.plot`) -and `~ultraplot.axes.PlotAxes.scatter`: +The following features are relevant for "1D" :class:`~ultraplot.axes.PlotAxes` commands +like :func:`~ultraplot.axes.PlotAxes.line` (equivalent to :func:`~ultraplot.axes.PlotAxes.plot`) +and :func:`~ultraplot.axes.PlotAxes.scatter`: -* The treatment of data arguments passed to the 1D `~ultraplot.axes.PlotAxes` +* The treatment of data arguments passed to the 1D :class:`~ultraplot.axes.PlotAxes` commands is :ref:`standardized `. This makes them more flexible and arguably more intuitive to use than their matplotlib counterparts. -* The `cycle` keyword is interpreted by the `~ultraplot.constructor.Cycle` +* The `cycle` keyword is interpreted by the :class:`~ultraplot.constructor.Cycle` :ref:`constructor function ` and applies :ref:`property cyclers ` on-the-fly. This permits succinct and flexible property cycler declaration. * The `legend` and `colorbar` keywords draw :ref:`on-the-fly legends and colorbars - ` using the result of the `~ultraplot.axes.PlotAxes` command. + ` using the result of the :class:`~ultraplot.axes.PlotAxes` command. Note that colorbars can be drawn from :ref:`lists of artists `. * The default `ylim` (`xlim`) in the presence of a fixed `xlim` (`ylim`) is now adjusted to exclude out-of-bounds data. This can be useful when "zooming in" on a dependent variable axis but can be disabled by setting :rcraw:`axes.inbounds` - to ``False`` or passing ``inbounds=False`` to `~ultraplot.axes.PlotAxes` commands. -* The `~ultraplot.axes.PlotAxes.bar` and `~ultraplot.axes.PlotAxes.barh` commands accept 2D + to ``False`` or passing ``inbounds=False`` to :class:`~ultraplot.axes.PlotAxes` commands. +* The :func:`~ultraplot.axes.PlotAxes.bar` and :func:`~ultraplot.axes.PlotAxes.barh` commands accept 2D arrays and can :ref:`stack or group ` successive columns. Likewise, the - `~ultraplot.axes.PlotAxes.area` and `~ultraplot.axes.PlotAxes.areax` commands (shorthands - for `~ultraplot.axes.PlotAxes.fill_between` and `~ultraplot.axes.PlotAxes.fill_betweenx`) + :func:`~ultraplot.axes.PlotAxes.area` and :func:`~ultraplot.axes.PlotAxes.areax` commands (shorthands + for :func:`~ultraplot.axes.PlotAxes.fill_between` and :func:`~ultraplot.axes.PlotAxes.fill_betweenx`) accept 2D arrays and can :ref:`stack or overlay ` successive columns. -* The `~ultraplot.axes.PlotAxes.bar`, `~ultraplot.axes.PlotAxes.barh`, - `~ultraplot.axes.PlotAxes.vlines`, `~ultraplot.axes.PlotAxes.hlines`, - `~ultraplot.axes.PlotAxes.area`, and `~ultraplot.axes.PlotAxes.areax` +* The :func:`~ultraplot.axes.PlotAxes.bar`, :func:`~ultraplot.axes.PlotAxes.barh`, + :func:`~ultraplot.axes.PlotAxes.vlines`, :func:`~ultraplot.axes.PlotAxes.hlines`, + :func:`~ultraplot.axes.PlotAxes.area`, and :func:`~ultraplot.axes.PlotAxes.areax` commands accept a `negpos` keyword argument that :ref:`assigns different colors ` to "negative" and "positive" regions. -* The `~ultraplot.axes.PlotAxes.linex` and `~ultraplot.axes.PlotAxes.scatterx` commands - are just like `~ultraplot.axes.PlotAxes.line` and `~ultraplot.axes.PlotAxes.scatter`, +* The :func:`~ultraplot.axes.PlotAxes.linex` and :func:`~ultraplot.axes.PlotAxes.scatterx` commands + are just like :func:`~ultraplot.axes.PlotAxes.line` and :func:`~ultraplot.axes.PlotAxes.scatter`, but positional arguments are interpreted as *x* coordinates or (*y*, *x*) pairs. - There are also the related commands `~ultraplot.axes.PlotAxes.stemx`, - `~ultraplot.axes.PlotAxes.stepx`, `~ultraplot.axes.PlotAxes.boxh` (shorthand for - `~ultraplot.axes.PlotAxes.boxploth`), and `~ultraplot.axes.PlotAxes.violinh` (shorthand - for `~ultraplot.axes.PlotAxes.violinploth`). -* The `~ultraplot.axes.PlotAxes.line`, `~ultraplot.axes.PlotAxes.linex`, - `~ultraplot.axes.PlotAxes.scatter`, `~ultraplot.axes.PlotAxes.scatterx`, - `~ultraplot.axes.PlotAxes.bar`, and `~ultraplot.axes.PlotAxes.barh` commands can + There are also the related commands :func:`~ultraplot.axes.PlotAxes.stemx`, + :func:`~ultraplot.axes.PlotAxes.stepx`, :func:`~ultraplot.axes.PlotAxes.boxh` (shorthand for + :func:`~ultraplot.axes.PlotAxes.boxploth`), and :func:`~ultraplot.axes.PlotAxes.violinh` (shorthand + for :func:`~ultraplot.axes.PlotAxes.violinploth`). +* The :func:`~ultraplot.axes.PlotAxes.line`, :func:`~ultraplot.axes.PlotAxes.linex`, + :func:`~ultraplot.axes.PlotAxes.scatter`, :func:`~ultraplot.axes.PlotAxes.scatterx`, + :func:`~ultraplot.axes.PlotAxes.bar`, and :func:`~ultraplot.axes.PlotAxes.barh` commands can draw vertical or horizontal :ref:`error bars or "shading" ` using a variety of keyword arguments. This is often more convenient than working directly with `~matplotlib.axes.Axes.errorbar` or `~matplotlib.axes.Axes.fill_between`. -* The `~ultraplot.axes.PlotAxes.parametric` command draws clean-looking +* The :func:`~ultraplot.axes.PlotAxes.parametric` command draws clean-looking :ref:`parametric lines ` by encoding the parametric coordinate using colormap colors rather than text annotations. -The following features are relevant for "2D" `~ultraplot.axes.PlotAxes` commands -like `~ultraplot.axes.PlotAxes.pcolor` and `~ultraplot.axes.PlotAxes.contour`: +The following features are relevant for "2D" :class:`~ultraplot.axes.PlotAxes` commands +like :func:`~ultraplot.axes.PlotAxes.pcolor` and :func:`~ultraplot.axes.PlotAxes.contour`: -* The treatment of data arguments passed to the 2D `~ultraplot.axes.PlotAxes` +* The treatment of data arguments passed to the 2D :class:`~ultraplot.axes.PlotAxes` commands is :ref:`standardized `. This makes them more flexible and arguably more intuitive to use than their matplotlib counterparts. * The `cmap` and `norm` :ref:`keyword arguments ` are interpreted - by the `~ultraplot.constructor.Colormap` and `~ultraplot.constructor.Norm` + by the :class:`~ultraplot.constructor.Colormap` and :class:`~ultraplot.constructor.Norm` :ref:`constructor functions `. This permits succinct and flexible colormap and normalizer application. * The `colorbar` keyword draws :ref:`on-the-fly colorbars ` using the result of the plotting command. Note that :ref:`"inset" colorbars ` can also be drawn, analogous to "inset" legends. -* The `~ultraplot.axes.PlotAxes.contour`, `~ultraplot.axes.PlotAxes.contourf`, - `~ultraplot.axes.PlotAxes.pcolormesh`, and `~ultraplot.axes.PlotAxes.pcolor` commands +* The :func:`~ultraplot.axes.PlotAxes.contour`, :func:`~ultraplot.axes.PlotAxes.contourf`, + :func:`~ultraplot.axes.PlotAxes.pcolormesh`, and :func:`~ultraplot.axes.PlotAxes.pcolor` commands all accept a `labels` keyword. This draws :ref:`contour and grid box labels ` on-the-fly. Labels are automatically colored black or white according to the luminance of the underlying grid box or filled contour. * The default `vmin` and `vmax` used to normalize colormaps now excludes data outside the *x* and *y* axis bounds `xlim` and `ylim` if they were explicitly fixed. This can be disabled by setting :rcraw:`cmap.inbounds` to ``False`` - or by passing ``inbounds=False`` to `~ultraplot.axes.PlotAxes` commands. + or by passing ``inbounds=False`` to :class:`~ultraplot.axes.PlotAxes` commands. * The `~ultraplot.colors.DiscreteNorm` normalizer is paired with most colormaps by default. It can easily divide colormaps into distinct levels, similar to contour plots. This can be disabled by setting :rcraw:`cmap.discrete` to ``False`` or - by passing ``discrete=False`` to `~ultraplot.axes.PlotAxes` commands. + by passing ``discrete=False`` to :class:`~ultraplot.axes.PlotAxes` commands. * The `~ultraplot.colors.DivergingNorm` normalizer is perfect for data with a :ref:`natural midpoint ` and offers both "fair" and "unfair" scaling. The `~ultraplot.colors.SegmentedNorm` normalizer can generate uneven color gradations useful for :ref:`unusual data distributions `. -* The `~ultraplot.axes.PlotAxes.heatmap` command invokes - `~ultraplot.axes.PlotAxes.pcolormesh` then applies an `equal axes apect ratio +* The :func:`~ultraplot.axes.PlotAxes.heatmap` command invokes + :func:`~ultraplot.axes.PlotAxes.pcolormesh` then applies an `equal axes apect ratio `__, adds ticks to the center of each gridbox, and disables minor ticks and gridlines. This can be convenient for things like covariance matrices. -* Coordinate centers passed to commands like `~ultraplot.axes.PlotAxes.pcolor` are +* Coordinate centers passed to commands like :func:`~ultraplot.axes.PlotAxes.pcolor` are automatically translated to "edges", and coordinate edges passed to commands like - `~ultraplot.axes.PlotAxes.contour` are automatically translated to "centers". In + :func:`~ultraplot.axes.PlotAxes.contour` are automatically translated to "centers". In matplotlib, ``pcolor`` simply truncates and offsets the data when it receives centers. -* Commands like `~ultraplot.axes.PlotAxes.pcolor`, `~ultraplot.axes.PlotAxes.contourf` - and `~ultraplot.axes.Axes.colorbar` automatically fix an irritating issue where +* Commands like :func:`~ultraplot.axes.PlotAxes.pcolor`, :func:`~ultraplot.axes.PlotAxes.contourf` + and :func:`~ultraplot.axes.Axes.colorbar` automatically fix an irritating issue where saved vector graphics appear to have thin white lines between `filled contours `__, `grid boxes `__, and `colorbar segments `__. This can be disabled by - passing ``edgefix=False`` to `~ultraplot.axes.PlotAxes` commands. + passing ``edgefix=False`` to :class:`~ultraplot.axes.PlotAxes` commands. Links ----- @@ -543,7 +543,7 @@ There are two widely-used engines for working with geographic data in matplotlib: `cartopy`_ and `basemap`_. Using cartopy tends to be verbose and involve boilerplate code, while using basemap requires plotting with a separate `~mpl_toolkits.basemap.Basemap` object rather than the -`~matplotlib.axes.Axes`. They both require separate import statements and extra +:class:`~matplotlib.axes.Axes`. They both require separate import statements and extra lines of code to configure the projection. Furthermore, when you use `cartopy`_ and `basemap`_ plotting @@ -555,13 +555,13 @@ longitude-latitude (i.e., "Plate Carrée") coordinates. Changes ------- -ultraplot can succinctly create detailed geographic plots using either cartopy or +UltraPlot can succinctly create detailed geographic plots using either cartopy or basemap as "backends". By default, cartopy is used, but basemap can be used by passing ``backend='basemap'`` to axes-creation commands or by setting :rcraw:`geo.backend` to ``'basemap'``. To create a geographic plot, simply pass the `PROJ `__ name to an axes-creation command, e.g. ``fig, ax = uplt.subplots(proj='pcarree')`` or ``fig.add_subplot(proj='pcarree')``. Alternatively, use the -`~ultraplot.constructor.Proj` constructor function to quickly generate +:class:`~ultraplot.constructor.Proj` constructor function to quickly generate a `cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap` instance. Requesting geographic projections creates a `ultraplot.axes.GeoAxes` @@ -569,14 +569,14 @@ with unified support for `cartopy`_ and `basemap`_ features via the `ultraplot.axes.GeoAxes.format` command. This lets you quickly modify geographic plot features like latitude and longitude gridlines, gridline labels, continents, coastlines, and political boundaries. The syntax is conveniently analogous to the -syntax used for `ultraplot.axes.CartesianAxes.format` and `ultraplot.axes.PolarAxes.format`. +syntax used for :func:`ultraplot.axes.CartesianAxes.format` and `ultraplot.axes.PolarAxes.format`. The `~ultraplot.axes.GeoAxes` subclass also makes longitude-latitude coordinates the "default" coordinate system by passing ``transform=ccrs.PlateCarree()`` -or ``latlon=True`` to `~ultraplot.axes.PlotAxes` commands (depending on whether cartopy +or ``latlon=True`` to :class:`~ultraplot.axes.PlotAxes` commands (depending on whether cartopy or basemap is the backend). And to enforce global coverage over the poles and across -longitude seams, you can pass ``globe=True`` to 2D `~ultraplot.axes.PlotAxes` commands -like `~ultraplot.axes.PlotAxes.contour` and `~ultraplot.axes.PlotAxes.pcolormesh`. +longitude seams, you can pass ``globe=True`` to 2D :class:`~ultraplot.axes.PlotAxes` commands +like :func:`~ultraplot.axes.PlotAxes.contour` and :func:`~ultraplot.axes.PlotAxes.pcolormesh`. Links ----- @@ -616,9 +616,9 @@ in their own right, without requiring special containers and a separate interfac Changes ------- -ultraplot reproduces many of the `xarray.DataArray.plot`, +UltraPlot reproduces many of the `xarray.DataArray.plot`, `pandas.DataFrame.plot`, and `pandas.Series.plot` -features directly on the `~ultraplot.axes.PlotAxes` commands. +features directly on the :class:`~ultraplot.axes.PlotAxes` commands. This includes :ref:`grouped or stacked ` bar plots and :ref:`layered or stacked ` area plots from two-dimensional input data, auto-detection of :ref:`diverging datasets ` for @@ -626,13 +626,13 @@ application of diverging colormaps and normalizers, and :ref:`on-the-fly colorbars and legends ` using `colorbar` and `legend` keywords. -ultraplot also handles metadata associated with `xarray.DataArray`, `pandas.DataFrame`, +UltraPlot also handles metadata associated with `xarray.DataArray`, `pandas.DataFrame`, `pandas.Series`, and `pint.Quantity` objects. When a plotting command receives these objects, it updates the axis tick labels, axis labels, subplot title, and colorbar and legend labels from the metadata. For `~pint.Quantity` arrays (including -`~pint.Quantity` those stored inside `~xarray.DataArray` containers), a unit string +`~pint.Quantity` those stored inside :class:`~xarray.DataArray` containers), a unit string is generated from the `pint.Unit` according to the :rcraw:`unitformat` setting -(note ultraplot also automatically calls `pint.UnitRegistry.setup_matplotlib` +(note UltraPlot also automatically calls `pint.UnitRegistry.setup_matplotlib` whenever a `~pint.Quantity` is used for *x* and *y* coordinates and removes the units from *z* coordinates to avoid the stripped-units warning message). These features can be disabled by setting :rcraw:`autoformat` to ``False`` @@ -641,9 +641,9 @@ or passing ``autoformat=False`` to any plotting command. Links ----- -* For integration with 1D `~ultraplot.axes.PlotAxes` commands, +* For integration with 1D :class:`~ultraplot.axes.PlotAxes` commands, see :ref:`this page `. -* For integration with 2D `~ultraplot.axes.PlotAxes` commands, +* For integration with 2D :class:`~ultraplot.axes.PlotAxes` commands, see :ref:`this page `. * For bar and area plots, see :ref:`this page `. @@ -678,35 +678,35 @@ Finally, matplotlib comes packaged with ``DejaVu Sans`` as the default font. This font is open source and include glyphs for a huge variety of characters. However in our opinion, it is not very aesthetically pleasing. It is also difficult to switch to other fonts on limited systems or systems with fonts -stored in incompatible file formats (see :ref:`below `). +stored in incompatible file formats (see :ref:`below `). Changes ------- -ultraplot adds new colormaps, colors, and fonts to help you make more +UltraPlot adds new colormaps, colors, and fonts to help you make more aesthetically pleasing figures. -* ultraplot adds colormaps from the `seaborn `_, `cmocean `_, +* UltraPlot adds colormaps from the `seaborn `_, `cmocean `_, `SciVisColor `_, and `Scientific Colour Maps `_ projects. It also defines a few default :ref:`perceptually uniform colormaps ` - and includes a `~ultraplot.colors.PerceptualColormap` class for generating + and includes a :class:`~ultraplot.colors.PerceptualColormap` class for generating new ones. A :ref:`table of colormap ` and :ref:`color cycles ` can be shown using - `~ultraplot.demos.show_cmaps` and `~ultraplot.demos.show_cycles`. + :func:`~ultraplot.demos.show_cmaps` and :func:`~ultraplot.demos.show_cycles`. Colormaps like ``'jet'`` can still be accessed, but this is discouraged. -* ultraplot adds colors from the `open color `_ project and adds +* UltraPlot adds colors from the `open color `_ project and adds `XKCD color survey `_ names without the ``'xkcd:'`` prefix after *filtering* them to exclude perceptually-similar colors and *normalizing* the naming pattern to make them more self-consistent. Old X11/CSS4 colors can still be accessed, but this is discouraged. A :ref:`table of color names ` - can be shown using `~ultraplot.demos.show_colors`. -* ultraplot comes packaged with several additional :ref:`sans-serif fonts + can be shown using :func:`~ultraplot.demos.show_colors`. +* UltraPlot comes packaged with several additional :ref:`sans-serif fonts ` and the entire `TeX Gyre `_ font series. TeX Gyre consists of open-source fonts designed to resemble more popular, commonly-used fonts like Helvetica and Century. They are used as the new default serif, sans-serif, monospace, cursive, and "fantasy" fonts, and they are available on all workstations. A :ref:`table of font names ` can be shown - using `~ultraplot.demos.show_fonts`. + using :func:`~ultraplot.demos.show_fonts`. Links ----- @@ -718,7 +718,7 @@ Links * For more on fonts, see :ref:`this page `. * For importing custom colormaps, colors, and fonts, - see :ref:`this page `. + see :ref:`this page `. .. _why_colormaps_cycles: @@ -733,7 +733,7 @@ In matplotlib, colormaps are implemented with the color gradations) and the `~matplotlib.colors.ListedColormap` class (representing "categorical" color sets). They are somewhat cumbersome to modify or create from scratch. Meanwhile, property cycles used for individual plot elements are implemented -with the `~cycler.Cycler` class. They are easier to modify but they cannot be +with the :class:`~cycler.Cycler` class. They are easier to modify but they cannot be "registered" by name like colormaps. The `seaborn`_ package includes "color palettes" to make working with colormaps @@ -743,27 +743,27 @@ integrated more closely with matplotlib's colormap and property cycle constructs Changes ------- -ultraplot tries to make it easy to manipulate colormaps and property cycles. +UltraPlot tries to make it easy to manipulate colormaps and property cycles. -* All colormaps in ultraplot are replaced with the `~ultraplot.colors.ContinuousColormap` - and `~ultraplot.colors.DiscreteColormap` subclasses of +* All colormaps in UltraPlot are replaced with the :class:`~ultraplot.colors.ContinuousColormap` + and :class:`~ultraplot.colors.DiscreteColormap` subclasses of `~matplotlib.colors.LinearSegmentedColormap` and `~matplotlib.colors.ListedColormap`. These classes include several useful features leveraged by the :ref:`constructor functions ` - `~ultraplot.constructor.Colormap` and `~ultraplot.constructor.Cycle`. -* The `~ultraplot.constructor.Colormap` function can merge, truncate, and + :class:`~ultraplot.constructor.Colormap` and :class:`~ultraplot.constructor.Cycle`. +* The :class:`~ultraplot.constructor.Colormap` function can merge, truncate, and modify existing colormaps or generate brand new colormaps. It can also - create new `~ultraplot.colors.PerceptualColormap`\ s -- a type of + create new :class:`~ultraplot.colors.PerceptualColormap`\ s -- a type of `ultraplot.colors.ContinuousColormap` with linear transitions in the :ref:`perceptually uniform-like ` hue, saturation, and luminance channels rather then the red, blue, and green channels. -* The `~ultraplot.constructor.Cycle` function can make property cycles from +* The :class:`~ultraplot.constructor.Cycle` function can make property cycles from scratch or retrieve "registered" color cycles from their associated - `~ultraplot.colors.DiscreteColormap` instances. It can also make property + :class:`~ultraplot.colors.DiscreteColormap` instances. It can also make property cycles by splitting up the colors from registered or on-the-fly - `~ultraplot.colors.ContinuousColormap`\ s and `~ultraplot.colors.PerceptualColormap`\ s. + :class:`~ultraplot.colors.ContinuousColormap`\ s and :class:`~ultraplot.colors.PerceptualColormap`\ s. -ultraplot also makes all colormap and color cycle names case-insensitive, and +UltraPlot also makes all colormap and color cycle names case-insensitive, and colormaps are automatically reversed or cyclically shifted 180 degrees if you append ``'_r'`` or ``'_s'`` to any colormap name. These features are powered by `~ultraplot.colors.ColormapDatabase`, which replaces matplotlib's native @@ -802,21 +802,21 @@ This may be confusing for users outside of the United States. Changes ------- -ultraplot uses physical units for the `~ultraplot.gridspec.GridSpec` keywords +UltraPlot uses physical units for the :class:`~ultraplot.gridspec.GridSpec` keywords `left`, `right`, `top`, `bottom`, `wspace`, `hspace`, `pad`, `outerpad`, and `innerpad`. The default unit (assumed when a numeric argument is passed) is `em-widths `__. Em-widths are particularly appropriate for this context, as plot text can be a useful "ruler" -when figuring out the amount of space you need. ultraplot also permits arbitrary -string units for these keywords, for the `~ultraplot.figure.Figure` keywords +when figuring out the amount of space you need. UltraPlot also permits arbitrary +string units for these keywords, for the :class:`~ultraplot.figure.Figure` keywords `figsize`, `figwidth`, `figheight`, `refwidth`, and `refheight`, and in a -few other places. This is powered by the physical units engine `~ultraplot.utils.units`. +few other places. This is powered by the physical units engine :func:`~ultraplot.utils.units`. Acceptable units include inches, centimeters, millimeters, pixels, `points `__, and `picas `__ (a table of acceptable -units is found :ref:`here `). Note the `~ultraplot.utils.units` engine -also translates rc settings assigned to `~ultraplot.config.rc_matplotlib` and -`~ultraplot.config.rc_ultraplot`, e.g. :rcraw:`subplots.refwidth`, +units is found :ref:`here `). Note the :func:`~ultraplot.utils.units` engine +also translates rc settings assigned to :func:`~ultraplot.config.rc_matplotlib` and +`~ultraplot.config.rc_UltraPlot`, e.g. :rcraw:`subplots.refwidth`, :rcraw:`legend.columnspacing`, and :rcraw:`axes.labelpad`. Links @@ -824,7 +824,7 @@ Links * For more on physical units, see :ref:`this page `. -* For more on `~ultraplot.gridspec.GridSpec` spacing units, +* For more on :class:`~ultraplot.gridspec.GridSpec` spacing units, see :ref:`this page ` * For more on colorbar width units, see :ref:`this page `, @@ -847,16 +847,16 @@ than globally. Changes ------- -In ultraplot, you can use the `~ultraplot.config.rc` object to change both native -matplotlib settings (found in `~ultraplot.config.rc_matplotlib`) and added ultraplot -settings (found in `~ultraplot.config.rc_ultraplot`). Assigned settings are always +In UltraPlot, you can use the :func:`~ultraplot.config.rc` object to change both native +matplotlib settings (found in :func:`~ultraplot.config.rc_matplotlib`) and added UltraPlot +settings (found in `~ultraplot.config.rc_UltraPlot`). Assigned settings are always validated, and "meta" settings like ``meta.edgecolor``, ``meta.linewidth``, and ``font.smallsize`` can be used to update many settings all at once. Settings can be changed with ``uplt.rc.key = value``, ``uplt.rc[key] = value``, ``uplt.rc.update(key=value)``, using `ultraplot.axes.Axes.format`, or using `ultraplot.config.Configurator.context`. Settings that have changed during the python session can be saved to a file with `ultraplot.config.Configurator.save` -(see `~ultraplot.config.Configurator.changed`), and settings can be loaded from +(see :func:`~ultraplot.config.Configurator.changed`), and settings can be loaded from files with `ultraplot.config.Configurator.load`. Links @@ -866,14 +866,14 @@ Links see :ref:`this page `. * For more on changing settings, see :ref:`this page `. -* For more on ultraplot settings, - see :ref:`this page `. +* For more on UltraPlot settings, + see :ref:`this page `. * For more on meta settings, see :ref:`this page `. * For a table of the new settings, see :ref:`this page `. -.. _why_dotultraplot: +.. _why_dotUltraPlot: Loading stuff ============= @@ -891,23 +891,23 @@ Linux servers with limited font selections. Changes ------- -ultraplot settings can be changed persistently by editing the default ``ultraplotrc`` -file in the location given by `~ultraplot.config.Configurator.user_file` (this is +UltraPlot settings can be changed persistently by editing the default ``ultraplotrc`` +file in the location given by :func:`~ultraplot.config.Configurator.user_file` (this is usually ``$HOME/.ultraplot/ultraplotrc``) or by adding loose ``ultraplotrc`` files to either the current directory or an arbitrary parent directory. Adding files to parent directories can be useful when working in projects with lots of subfolders. -ultraplot also automatically registers colormaps, color cycles, colors, and font +UltraPlot also automatically registers colormaps, color cycles, colors, and font files stored in subfolders named ``cmaps``, ``cycles``, ``colors``, and ``fonts`` -in the location given by `~ultraplot.config.Configurator.user_folder` (this is usually +in the location given by :func:`~ultraplot.config.Configurator.user_folder` (this is usually ``$HOME/.ultraplot``), as well as loose subfolders named ``ultraplot_cmaps``, ``ultraplot_cycles``, ``ultraplot_colors``, and ``ultraplot_fonts`` in the current directory or an arbitrary parent directory. You can save colormaps and color cycles to -`~ultraplot.config.Configurator.user_folder` simply by passing ``save=True`` to -`~ultraplot.constructor.Colormap` and `~ultraplot.constructor.Cycle`. To re-register +:func:`~ultraplot.config.Configurator.user_folder` simply by passing ``save=True`` to +:class:`~ultraplot.constructor.Colormap` and :class:`~ultraplot.constructor.Cycle`. To re-register these files during an active python session, or to register arbitrary input arguments, -you can use `~ultraplot.config.register_cmaps`, `~ultraplot.config.register_cycles`, -`~ultraplot.config.register_colors`, or `~ultraplot.config.register_fonts`. +you can use :func:`~ultraplot.config.register_cmaps`, :func:`~ultraplot.config.register_cycles`, +:func:`~ultraplot.config.register_colors`, or :func:`~ultraplot.config.register_fonts`. Links ----- diff --git a/environment.yml b/environment.yml index 3fe4a8c28..4da5dec1c 100644 --- a/environment.yml +++ b/environment.yml @@ -14,7 +14,7 @@ dependencies: - jupyter - pip - pint - - sphinx + - sphinx==8.1.3 # temporary pin to allow extensions to catch up - nbsphinx - jupytext - sphinx-copybutton diff --git a/ultraplot/axes/base.py b/ultraplot/axes/base.py index f84d602e9..28ece2647 100644 --- a/ultraplot/axes/base.py +++ b/ultraplot/axes/base.py @@ -87,7 +87,7 @@ str, `cartopy.crs.Projection`, or `~mpl_toolkits.basemap.Basemap`, optional The map projection specification(s). If ``'cart'`` or ``'cartesian'`` (the default), a `~ultraplot.axes.CartesianAxes` is created. If ``'polar'``, - a `~ultraplot.axes.PolarAxes` is created. Otherwise, the argument is + a :class:`~ultraplot.axes.PolarAxes` is created. Otherwise, the argument is interpreted by `~ultraplot.constructor.Proj`, and the result is used to make a `~ultraplot.axes.GeoAxes` (in this case the argument can be a `cartopy.crs.Projection` instance, a `~mpl_toolkits.basemap.Basemap` @@ -417,11 +417,11 @@ 2. A `~matplotlib.colors.Colormap` or registered colormap name used to build a `~matplotlib.cm.ScalarMappable` on-the-fly. The colorbar range and ticks depend on the arguments `values`, `vmin`, `vmax`, and `norm`. The default for a - `~ultraplot.colors.ContinuousColormap` is ``vmin=0`` and ``vmax=1`` (note that + :class:`~ultraplot.colors.ContinuousColormap` is ``vmin=0`` and ``vmax=1`` (note that passing `values` will "discretize" the colormap). The default for a - `~ultraplot.colors.DiscreteColormap` is ``values=np.arange(0, cmap.N)``. + :class:`~ultraplot.colors.DiscreteColormap` is ``values=np.arange(0, cmap.N)``. 3. A sequence of hex strings, color names, or RGB[A] tuples. A - `~ultraplot.colors.DiscreteColormap` will be generated from these colors and + :class:`~ultraplot.colors.DiscreteColormap` will be generated from these colors and used to build a `~matplotlib.cm.ScalarMappable` on-the-fly. The colorbar range and ticks depend on the arguments `values`, `norm`, and `norm_kw`. The default is ``values=np.arange(0, len(mappable))``. @@ -436,7 +436,7 @@ values : sequence of float or str, optional Ignored if `mappable` is a `~matplotlib.cm.ScalarMappable`. This maps the colormap colors to numeric values using `~ultraplot.colors.DiscreteNorm`. If the colormap is - a `~ultraplot.colors.ContinuousColormap` then its colors will be "discretized". + a :class:`~ultraplot.colors.ContinuousColormap` then its colors will be "discretized". These These can also be strings, in which case the list indices are used for tick locations and the strings are applied as tick labels. """ @@ -446,7 +446,7 @@ or figure where the colorbar is drawn. Inset colorbars are always horizontal. norm : norm-spec, optional Ignored if `mappable` is a `~matplotlib.cm.ScalarMappable`. This is the continuous - normalizer used to scale the `~ultraplot.colors.ContinuousColormap` (or passed + normalizer used to scale the :class:`~ultraplot.colors.ContinuousColormap` (or passed to `~ultraplot.colors.DiscreteNorm` if `values` was passed). Passed to the `~ultraplot.constructor.Norm` constructor function. norm_kw : dict-like, optional @@ -3247,7 +3247,7 @@ def _iter_axes(self, hidden=False, children=False, panels=True): def number(self): """ The axes number. This controls the order of a-b-c labels and the - order of appearance in the `~ultraplot.gridspec.SubplotGrid` returned + order of appearance in the :class:`~ultraplot.gridspec.SubplotGrid` returned by `~ultraplot.figure.Figure.subplots`. """ return self._number diff --git a/ultraplot/axes/cartesian.py b/ultraplot/axes/cartesian.py index 2cf34bdc3..19c07defe 100644 --- a/ultraplot/axes/cartesian.py +++ b/ultraplot/axes/cartesian.py @@ -37,7 +37,7 @@ # Format docstring _format_docstring = """ aspect : {'auto', 'equal'} or float, optional - The data aspect ratio. See `~matplotlib.axes.Axes.set_aspect` + The data aspect ratio. See :func:`~matplotlib.axes.Axes.set_aspect` for details. xlabel, ylabel : str, optional The x and y axis labels. Applied with `~matplotlib.axes.Axes.set_xlabel` @@ -47,8 +47,8 @@ and `~matplotlib.axes.Axes.set_ylabel`. See also `labelpad`, `labelcolor`, `labelsize`, and `labelweight` below. xlim, ylim : 2-tuple of floats or None, optional - The x and y axis data limits. Applied with `~matplotlib.axes.Axes.set_xlim` - and `~matplotlib.axes.Axes.set_ylim`. + The x and y axis data limits. Applied with :func:`~matplotlib.axes.Axes.set_xlim` + and :func:`~matplotlib.axes.Axes.set_ylim`. xmin, ymin : float, optional The x and y minimum data limits. Useful if you do not want to set the maximum limits. diff --git a/ultraplot/axes/geo.py b/ultraplot/axes/geo.py index 570222765..41e2b929a 100644 --- a/ultraplot/axes/geo.py +++ b/ultraplot/axes/geo.py @@ -113,8 +113,8 @@ and the ``(left, right)`` sides for latitudes. * A boolean 4-tuple indicating whether to draw labels on the ``(left, right, bottom, top)`` sides, as with the basemap - `~mpl_toolkits.basemap.Basemap.drawmeridians` and - `~mpl_toolkits.basemap.Basemap.drawparallels` `labels` keyword. + :func:`~mpl_toolkits.basemap.Basemap.drawmeridians` and + :func:`~mpl_toolkits.basemap.Basemap.drawparallels` `labels` keyword. loninline, latinline, inlinelabels : bool, default: :rc:`grid.inlinelabels` *For cartopy axes only.* @@ -165,7 +165,7 @@ must be passed to `~ultraplot.constructor.Proj` instead. color : color-spec, default: :rc:`meta.color` The color for the axes edge. Propagates to `labelcolor` unless specified - otherwise (similar to `ultraplot.axes.CartesianAxes.format`). + otherwise (similar to :func:`ultraplot.axes.CartesianAxes.format`). gridcolor : color-spec, default: :rc:`grid.color` The color for the gridline labels. labelcolor : color-spec, default: `color` or :rc:`grid.labelcolor` @@ -771,8 +771,8 @@ def gridlines_major(self): The cartopy `~cartopy.mpl.gridliner.Gridliner` used for major gridlines or a 2-tuple containing the (longitude, latitude) major gridlines returned by - basemap's `~mpl_toolkits.basemap.Basemap.drawmeridians` - and `~mpl_toolkits.basemap.Basemap.drawparallels`. + basemap's :func:`~mpl_toolkits.basemap.Basemap.drawmeridians` + and :func:`~mpl_toolkits.basemap.Basemap.drawparallels`. This can be used for customization and debugging. """ if self._name == "basemap": @@ -786,8 +786,8 @@ def gridlines_minor(self): The cartopy `~cartopy.mpl.gridliner.Gridliner` used for minor gridlines or a 2-tuple containing the (longitude, latitude) minor gridlines returned by - basemap's `~mpl_toolkits.basemap.Basemap.drawmeridians` - and `~mpl_toolkits.basemap.Basemap.drawparallels`. + basemap's :func:`~mpl_toolkits.basemap.Basemap.drawmeridians` + and :func:`~mpl_toolkits.basemap.Basemap.drawparallels`. This can be used for customization and debugging. """ if self._name == "basemap": diff --git a/ultraplot/axes/plot.py b/ultraplot/axes/plot.py index ad06f7f34..b8852e89c 100644 --- a/ultraplot/axes/plot.py +++ b/ultraplot/axes/plot.py @@ -63,8 +63,8 @@ The data passed as positional or keyword arguments. Interpreted as follows: * If only `{y}` coordinates are passed, try to infer the `{x}` coordinates - from the `~pandas.Series` or `~pandas.DataFrame` indices or the - `~xarray.DataArray` coordinates. Otherwise, the `{x}` coordinates + from the `~pandas.Series` or :class:`~pandas.DataFrame` indices or the + :class:`~xarray.DataArray` coordinates. Otherwise, the `{x}` coordinates are ``np.arange(0, {y}.shape[0])``. * If the `{y}` coordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as with @@ -78,7 +78,7 @@ The data passed as positional or keyword arguments. Interpreted as follows: * If only `{y}` coordinates are passed, try to infer the `{x}` coordinates from - the `~pandas.Series` or `~pandas.DataFrame` indices or the `~xarray.DataArray` + the `~pandas.Series` or :class:`~pandas.DataFrame` indices or the :class:`~xarray.DataArray` coordinates. Otherwise, the `{x}` coordinates are ``np.arange(0, {y}2.shape[0])``. * If only `{x}` and `{y}2` coordinates are passed, set the `{y}1` coordinates to zero. This draws elements originating from the zero line. @@ -93,11 +93,11 @@ The data passed as positional or keyword arguments. Interpreted as follows: * If only {zvar} coordinates are passed, try to infer the `x` and `y` coordinates - from the `~pandas.DataFrame` indices and columns or the `~xarray.DataArray` + from the :class:`~pandas.DataFrame` indices and columns or the :class:`~xarray.DataArray` coordinates. Otherwise, the `y` coordinates are ``np.arange(0, y.shape[0])`` and the `x` coordinates are ``np.arange(0, y.shape[1])``. * For ``pcolor`` and ``pcolormesh``, calculate coordinate *edges* using - `~ultraplot.utils.edges` or `~ultraplot.utils.edges2d` if *centers* were provided. + `~ultraplot.utils.edges` or `:func:`~ultraplot.utils.edges2d`` if *centers* were provided. For all other methods, calculate coordinate *centers* if *edges* were provided. * If the `x` or `y` coordinates are `pint.Quantity`, auto-add the pint unit registry to matplotlib's unit registry using `~pint.UnitRegistry.setup_matplotlib`. If the @@ -123,7 +123,7 @@ # Shared docstrings _args_1d_shared_docstring = """ data : dict-like, optional - A dict-like dataset container (e.g., `~pandas.DataFrame` or + A dict-like dataset container (e.g., :class:`~pandas.DataFrame` or `~xarray.Dataset`). If passed, each data argument can optionally be a string `key` and the arrays used for plotting are retrieved with ``data[key]``. This is a `native matplotlib feature @@ -131,7 +131,7 @@ autoformat : bool, default: :rc:`autoformat` Whether the `x` axis labels, `y` axis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when a - `~pandas.Series`, `~pandas.DataFrame`, `~xarray.DataArray`, or `~pint.Quantity` + `~pandas.Series`, :class:`~pandas.DataFrame`, :class:`~xarray.DataArray`, or `~pint.Quantity` is passed to the plotting command. Formatting of `pint.Quantity` unit strings is controlled by :rc:`unitformat`. """ @@ -177,9 +177,9 @@ resulting object(s). If ``True``, the default :rc:`legend.loc` is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations - are shown in `~ultraplot.axes.Axes.legend`. + are shown in :class:`~ultraplot.axes.Axes.legend`. legend_kw : dict-like, optional - Extra keyword args for the call to `~ultraplot.axes.Axes.legend`. + Extra keyword args for the call to :class:`~ultraplot.axes.Axes.legend`. """ docstring._snippet_manager["plot.guide"] = _guide_docstring @@ -298,14 +298,14 @@ _cmap_norm_docstring = """ cmap : colormap-spec, default: \ :rc:`cmap.sequential` or :rc:`cmap.diverging` - The colormap specifer, passed to the `~ultraplot.constructor.Colormap` constructor + The colormap specifer, passed to the :class:`~ultraplot.constructor.Colormap` constructor function. If :rcraw:`cmap.autodiverging` is ``True`` and the normalization range contains negative and positive values then :rcraw:`cmap.diverging` is used. Otherwise :rcraw:`cmap.sequential` is used. cmap_kw : dict-like, optional - Passed to `~ultraplot.constructor.Colormap`. + Passed to :class:`~ultraplot.constructor.Colormap`. c, color, colors : color-spec or sequence of color-spec, optional - The color(s) used to create a `~ultraplot.colors.DiscreteColormap`. + The color(s) used to create a :class:`~ultraplot.colors.DiscreteColormap`. If not passed, `cmap` is used. norm : norm-spec, default: \ `~matplotlib.colors.Normalize` or `~ultraplot.colors.DivergingNorm` @@ -377,8 +377,8 @@ when your data has large outliers. inbounds : bool, default: :rc:`cmap.inbounds` If ``True`` and `vmin` or `vmax` were not provided, when axis limits - have been explicitly restricted with `~matplotlib.axes.Axes.set_xlim` - or `~matplotlib.axes.Axes.set_ylim`, out-of-bounds data is ignored. + have been explicitly restricted with :func:`~matplotlib.axes.Axes.set_xlim` + or :func:`~matplotlib.axes.Axes.set_ylim`, out-of-bounds data is ignored. See also :rcraw:`cmap.inbounds` and :rcraw:`axes.inbounds`. locator : locator-spec, default: `matplotlib.ticker.MaxNLocator` The locator used to determine level locations if `levels` or `values` were not @@ -486,7 +486,7 @@ %(plot.labels_1d)s %(plot.guide)s **kwargs - Passed to `~matplotlib.axes.Axes.plot`. + Passed to :func:`~matplotlib.axes.Axes.plot`. See also -------- @@ -619,11 +619,11 @@ %(plot.label)s %(plot.guide)s **kwargs - Valid `~matplotlib.collections.LineCollection` properties. + Valid :class:`~matplotlib.collections.LineCollection` properties. Returns ------- -`~matplotlib.collections.LineCollection` +:class:`~matplotlib.collections.LineCollection` The parametric line. See `this matplotlib example \ `__. diff --git a/ultraplot/axes/polar.py b/ultraplot/axes/polar.py index dde86b2cb..d66e3e2ea 100644 --- a/ultraplot/axes/polar.py +++ b/ultraplot/axes/polar.py @@ -78,7 +78,7 @@ `~ultraplot.constructor.Formatter`. color : color-spec, default: :rc:`meta.color` Color for the axes edge. Propagates to `labelcolor` unless specified - otherwise (similar to `ultraplot.axes.CartesianAxes.format`). + otherwise (similar to :func:`ultraplot.axes.CartesianAxes.format`). labelcolor, gridlabelcolor : color-spec, default: `color` or :rc:`grid.labelcolor` Color for the gridline labels. labelpad, gridlabelpad : unit-spec, default: :rc:`grid.labelpad` diff --git a/ultraplot/axes/shared.py b/ultraplot/axes/shared.py index d589e5c6e..ec184761c 100644 --- a/ultraplot/axes/shared.py +++ b/ultraplot/axes/shared.py @@ -16,7 +16,7 @@ class _SharedAxes(object): """ Mix-in class with methods shared between `~ultraplot.axes.CartesianAxes` - and `~ultraplot.axes.PolarAxes`. + and :class:`~ultraplot.axes.PolarAxes`. """ @staticmethod diff --git a/ultraplot/axes/three.py b/ultraplot/axes/three.py index 2e59db94f..957d8fea0 100644 --- a/ultraplot/axes/three.py +++ b/ultraplot/axes/three.py @@ -16,7 +16,7 @@ class ThreeAxes(shared._SharedAxes, base.Axes, Axes3D): Important --------- - Note that this subclass does *not* implement the `~ultraplot.axes.PlotAxes` + Note that this subclass does *not* implement the :class:`~ultraplot.axes.PlotAxes` plotting overrides. This axes subclass can be used by passing ``proj='3d'`` or ``proj='three'`` to axes-creation commands like `~ultraplot.figure.Figure.add_axes`, `~ultraplot.figure.Figure.add_subplot`, and `~ultraplot.figure.Figure.subplots`. diff --git a/ultraplot/colors.py b/ultraplot/colors.py index 53c8908b4..5d5b03591 100644 --- a/ultraplot/colors.py +++ b/ultraplot/colors.py @@ -1304,7 +1304,7 @@ def save(self, path=None, alpha=True): ---------- path : path-like, optional The output filename. If not provided, the colormap is saved in the - ``cmaps`` subfolder in `~ultraplot.config.Configurator.user_folder` + ``cmaps`` subfolder in :func:`~ultraplot.config.Configurator.user_folder` under the filename ``name.json`` (where ``name`` is the colormap name). Valid extensions are shown in the below table. @@ -1778,7 +1778,7 @@ def save(self, path=None, alpha=True): ---------- path : path-like, optional The output filename. If not provided, the colormap is saved in the - ``cycles`` subfolder in `~ultraplot.config.Configurator.user_folder` + ``cycles`` subfolder in :func:`~ultraplot.config.Configurator.user_folder` under the filename ``name.hex`` (where ``name`` is the color cycle name). Valid extensions are described in the below table. @@ -3038,7 +3038,7 @@ def __getitem__(self, key): This works everywhere that colors are used in matplotlib, for example as `color`, `edgecolor', or `facecolor` keyword arguments - passed to `~ultraplot.axes.PlotAxes` commands. + passed to :class:`~ultraplot.axes.PlotAxes` commands. """ key = self._parse_key(key) return dict.__getitem__(self, key) diff --git a/ultraplot/constructor.py b/ultraplot/constructor.py index a673668ea..de7874c2f 100644 --- a/ultraplot/constructor.py +++ b/ultraplot/constructor.py @@ -404,9 +404,9 @@ def Colormap( ): """ Generate, retrieve, modify, and/or merge instances of - `~ultraplot.colors.PerceptualColormap`, - `~ultraplot.colors.ContinuousColormap`, and - `~ultraplot.colors.DiscreteColormap`. + :class:`~ultraplot.colors.PerceptualColormap`, + :class:`~ultraplot.colors.ContinuousColormap`, and + :class:`~ultraplot.colors.DiscreteColormap`. Parameters ---------- @@ -424,17 +424,17 @@ def Colormap( is loaded with `ultraplot.colors.ContinuousColormap.from_file` or `ultraplot.colors.DiscreteColormap.from_file` depending on the value of `filemode` (see below). Default behavior is to load a - `~ultraplot.colors.ContinuousColormap`. - * If RGB tuple or color string, a `~ultraplot.colors.PerceptualColormap` + :class:`~ultraplot.colors.ContinuousColormap`. + * If RGB tuple or color string, a :class:`~ultraplot.colors.PerceptualColormap` is generated with `~ultraplot.colors.PerceptualColormap.from_color`. If the string ends in ``'_r'``, the monochromatic map will be *reversed*, i.e. will go from dark to light instead of light to dark. * If sequence of RGB tuples or color strings, a - `~ultraplot.colors.DiscreteColormap`, `~ultraplot.colors.PerceptualColormap`, - or `~ultraplot.colors.ContinuousColormap` is generated depending on + :class:`~ultraplot.colors.DiscreteColormap`, :class:`~ultraplot.colors.PerceptualColormap`, + or :class:`~ultraplot.colors.ContinuousColormap` is generated depending on the value of `listmode` (see below). Default behavior is to generate a - `~ultraplot.colors.PerceptualColormap`. - * If dictionary, a `~ultraplot.colors.PerceptualColormap` is + :class:`~ultraplot.colors.PerceptualColormap`. + * If dictionary, a :class:`~ultraplot.colors.PerceptualColormap` is generated with `~ultraplot.colors.PerceptualColormap.from_hsl`. The dictionary should contain the keys ``'hue'``, ``'saturation'``, ``'luminance'``, and optionally ``'alpha'``, or their aliases (see below). @@ -449,9 +449,9 @@ def Colormap( * If ``'perceptual'`` or ``'continuous'``, a colormap is generated using `~ultraplot.colors.ContinuousColormap.from_file`. The resulting - colormap may be a `~ultraplot.colors.ContinuousColormap` or - `~ultraplot.colors.PerceptualColormap` depending on the data file. - * If ``'discrete'``, a `~ultraplot.colors.DiscreteColormap` is generated + colormap may be a :class:`~ultraplot.colors.ContinuousColormap` or + :class:`~ultraplot.colors.PerceptualColormap` depending on the data file. + * If ``'discrete'``, a :class:`~ultraplot.colors.DiscreteColormap` is generated using `~ultraplot.colors.ContinuousColormap.from_file`. Default is ``'continuous'`` when calling `Colormap` directly and @@ -460,33 +460,33 @@ def Colormap( Controls how colormaps are generated when you input sequence(s) of colors. The options are as follows: - * If ``'perceptual'``, a `~ultraplot.colors.PerceptualColormap` + * If ``'perceptual'``, a :class:`~ultraplot.colors.PerceptualColormap` is generated with `~ultraplot.colors.PerceptualColormap.from_list`. - * If ``'continuous'``, a `~ultraplot.colors.ContinuousColormap` is + * If ``'continuous'``, a :class:`~ultraplot.colors.ContinuousColormap` is generated with `~ultraplot.colors.ContinuousColormap.from_list`. - * If ``'discrete'``, a `~ultraplot.colors.DiscreteColormap` is generated + * If ``'discrete'``, a :class:`~ultraplot.colors.DiscreteColormap` is generated by simply passing the colors to the class. Default is ``'perceptual'`` when calling `Colormap` directly and ``'discrete'`` when `Colormap` is called by `Cycle`. samples : int or sequence of int, optional - For `~ultraplot.colors.ContinuousColormap`\\ s, this is used to - generate `~ultraplot.colors.DiscreteColormap`\\ s with + For :class:`~ultraplot.colors.ContinuousColormap`\\ s, this is used to + generate :class:`~ultraplot.colors.DiscreteColormap`\\ s with `~ultraplot.colors.ContinuousColormap.to_discrete`. For - `~ultraplot.colors.DiscreteColormap`\\ s, this is used to updates the + :class:`~ultraplot.colors.DiscreteColormap`\\ s, this is used to updates the number of colors in the cycle. If `samples` is integer, it applies to the final *merged* colormap. If it is a sequence of integers, it applies to each input colormap individually. discrete : bool, optional If ``True``, when the final colormap is a - `~ultraplot.colors.DiscreteColormap`, we leave it alone, but when it is a - `~ultraplot.colors.ContinuousColormap`, we always call + :class:`~ultraplot.colors.DiscreteColormap`, we leave it alone, but when it is a + :class:`~ultraplot.colors.ContinuousColormap`, we always call `~ultraplot.colors.ContinuousColormap.to_discrete` with a default `samples` value of ``10``. This argument is not necessary if you provide the `samples` argument. left, right : float or sequence of float, optional Truncate the left or right edges of the colormap. - Passed to `~ultraplot.colors.ContinuousColormap.truncate`. + Passed to :method:`~ultraplot.colors.ContinuousColormap.truncate`. If float, these apply to the final *merged* colormap. If sequence of float, these apply to each input colormap individually. cut : float or sequence of float, optional @@ -501,7 +501,7 @@ def Colormap( sequence of float, these apply to each input colormap individually. shift : float or sequence of float, optional Cyclically shift the colormap. - Passed to `~ultraplot.colors.ContinuousColormap.shifted`. + Passed to :property:`~ultraplot.colors.ContinuousColormap.shifted`. If float, this applies to the final *merged* colormap. If sequence of float, these apply to each input colormap individually. a @@ -556,8 +556,8 @@ def Colormap( Returns ------- matplotlib.colors.Colormap - A `~ultraplot.colors.ContinuousColormap` or - `~ultraplot.colors.DiscreteColormap` instance. + A :class:`~ultraplot.colors.ContinuousColormap` or + :class:`~ultraplot.colors.DiscreteColormap` instance. See also -------- @@ -787,12 +787,12 @@ class Cycle(cycler.Cycler): * If a `~cycler.Cycler`, nothing more is done. * If a sequence of RGB tuples or color strings, these colors are used. - * If a `~ultraplot.colors.DiscreteColormap`, colors from the ``colors`` + * If a :class:`~ultraplot.colors.DiscreteColormap`, colors from the ``colors`` attribute are used. - * If a string cycle name, that `~ultraplot.colors.DiscreteColormap` + * If a string cycle name, that :class:`~ultraplot.colors.DiscreteColormap` is looked up and its ``colors`` are used. * In all other cases, the argument is passed to `Colormap`, and - colors from the resulting `~ultraplot.colors.ContinuousColormap` + colors from the resulting :class:`~ultraplot.colors.ContinuousColormap` are used. See the `samples` argument. If the last positional argument is numeric, it is used for the @@ -800,10 +800,10 @@ class Cycle(cycler.Cycler): N Shorthand for `samples`. samples : float or sequence of float, optional - For `~ultraplot.colors.DiscreteColormap`\\ s, this is the number of + For :class:`~ultraplot.colors.DiscreteColormap`\\ s, this is the number of colors to select. For example, ``Cycle('538', 4)`` returns the first 4 colors of the ``'538'`` color cycle. - For `~ultraplot.colors.ContinuousColormap`\\ s, this is either a + For :class:`~ultraplot.colors.ContinuousColormap`\\ s, this is either a sequence of sample coordinates used to draw colors from the colormap, or an integer number of colors to draw. If the latter, the sample coordinates are ``np.linspace(0, 1, samples)``. For example, ``Cycle('Reds', 5)`` @@ -838,7 +838,7 @@ class Cycle(cycler.Cycler): Aliases for the above keywords. **kwargs If the input is not already a `~cycler.Cycler` instance, these are passed - to `Colormap` and used to build the `~ultraplot.colors.DiscreteColormap` + to `Colormap` and used to build the :class:`~ultraplot.colors.DiscreteColormap` from which the cycler will draw its colors. See also @@ -1058,7 +1058,7 @@ def Locator(locator, *args, discrete=False, **kwargs): ``'fixed'`` `~matplotlib.ticker.FixedLocator` Ticks at these exact locations ``'discrete'`` `~ultraplot.ticker.DiscreteLocator` Major ticks restricted to these locations but subsampled depending on the axis length ``'discreteminor'`` `~ultraplot.ticker.DiscreteLocator` Minor ticks restricted to these locations but subsampled depending on the axis length - ``'index'`` `~ultraplot.ticker.IndexLocator` Ticks on the non-negative integers + ``'index'`` :class:`~ultraplot.ticker.IndexLocator` Ticks on the non-negative integers ``'linear'`` `~matplotlib.ticker.LinearLocator` Exactly ``N`` ticks encompassing axis limits, spaced as ``numpy.linspace(lo, hi, N)`` ``'log'`` `~matplotlib.ticker.LogLocator` For log-scale axes ``'logminor'`` `~matplotlib.ticker.LogLocator` For log-scale axes on the 1st through 9th multiples of each power of the base @@ -1164,7 +1164,7 @@ def Formatter(formatter, *args, date=False, index=False, **kwargs): Returns a `~matplotlib.ticker.FuncFormatter`. * If sequence of strings, the ticks are labeled with these strings. Returns a `~matplotlib.ticker.FixedFormatter` by default or - an `~ultraplot.ticker.IndexFormatter` if `index` is ``True``. + an :class:`~ultraplot.ticker.IndexFormatter` if `index` is ``True``. * If a string containing ``{x}`` or ``{x:...}``, ticks will be formatted by calling ``string.format(x=number)``. Returns a `~matplotlib.ticker.StrMethodFormatter`. @@ -1205,7 +1205,7 @@ def Formatter(formatter, *args, date=False, index=False, **kwargs): ``'fixed'`` `~matplotlib.ticker.FixedFormatter` List of strings ``'formatstr'`` `~matplotlib.ticker.FormatStrFormatter` From C-style ``string % format`` notation ``'func'`` `~matplotlib.ticker.FuncFormatter` Use an arbitrary function - ``'index'`` `~ultraplot.ticker.IndexFormatter` List of strings corresponding to non-negative integer positions + ``'index'`` :class:`~ultraplot.ticker.IndexFormatter` List of strings corresponding to non-negative integer positions ``'log'`` `~matplotlib.ticker.LogFormatterSciNotation` For log-scale axes with scientific notation ``'logit'`` `~matplotlib.ticker.LogitFormatter` For logistic-scale axes ``'percent'`` `~matplotlib.ticker.PercentFormatter` Trailing percent sign diff --git a/ultraplot/demos.py b/ultraplot/demos.py index d5981b4fe..9b306420b 100644 --- a/ultraplot/demos.py +++ b/ultraplot/demos.py @@ -1039,7 +1039,7 @@ def show_fonts( *args : str or `~matplotlib.font_manager.FontProperties` The font specs, font names, or `~matplotlib.font_manager.FontProperties`\\ s to show. If no positional arguments are passed and the `family` argument is - not passed, then the fonts found in `~ultraplot.config.Configurator.user_folder` + not passed, then the fonts found in :func:`~ultraplot.config.Configurator.user_folder` and `~ultraplot.config.Configurator.local_folders` and the *available* :rcraw:`font.sans-serif` fonts are shown. family \ @@ -1051,7 +1051,7 @@ def show_fonts( :rcraw:`font.fantasy`. The special family ``'tex-gyre'`` includes the `TeX Gyre `__ fonts. user : bool, optional - Whether to include fonts in `~ultraplot.config.Configurator.user_folder` and + Whether to include fonts in :func:`~ultraplot.config.Configurator.user_folder` and `~ultraplot.config.Configurator.local_folders` at the top of the table. Default is ``True`` if called without any arguments and ``False`` otherwise. text : str, optional diff --git a/ultraplot/figure.py b/ultraplot/figure.py index 2796456e9..d506cf753 100644 --- a/ultraplot/figure.py +++ b/ultraplot/figure.py @@ -71,7 +71,7 @@ if both `figwidth` *and* `figheight` or both `refwidth` *and* `refheight` were passed. The default value is ``1`` or the "data aspect ratio" if the latter is explicitly fixed (as with `~ultraplot.axes.PlotAxes.imshow` plots and - `~ultraplot.axes.Axes.GeoAxes` projections; see `~matplotlib.axes.Axes.set_aspect`). + `~ultraplot.axes.Axes.GeoAxes` projections; see :func:`~matplotlib.axes.Axes.set_aspect`). refwidth, refheight : unit-spec, default: :rc:`subplots.refwidth` The width, height of the reference subplot. %(units.in)s @@ -176,8 +176,8 @@ # Multiple subplots _subplots_params_docstring = """ array : `ultraplot.gridspec.GridSpec` or array-like of int, optional - The subplot grid specifier. If a `~ultraplot.gridspec.GridSpec`, one subplot is - drawn for each unique `~ultraplot.gridspec.GridSpec` slot. If a 2D array of integers, + The subplot grid specifier. If a :class:`~ultraplot.gridspec.GridSpec`, one subplot is + drawn for each unique :class:`~ultraplot.gridspec.GridSpec` slot. If a 2D array of integers, one subplot is drawn for each unique integer in the array. Think of this array as a "picture" of the subplot grid -- for example, the array ``[[1, 1], [2, 3]]`` creates one long subplot in the top row, two smaller subplots in the bottom row. @@ -278,7 +278,7 @@ * Three positional arguments specifying the number of rows, number of columns, and gridspec number (int) or number range (2-tuple of int). * A `~matplotlib.gridspec.SubplotSpec` instance generated by indexing - a ultraplot `~ultraplot.gridspec.GridSpec`. + a ultraplot :class:`~ultraplot.gridspec.GridSpec`. For integer input, the implied geometry must be compatible with the implied geometry from previous calls -- for example, ``fig.add_subplot(331)`` followed @@ -286,7 +286,7 @@ be tiled into the 3 rows of the the first input, but ``fig.add_subplot(232)`` will raise an error because 2 rows cannot be tiled into 3 rows. For `~matplotlib.gridspec.SubplotSpec` input, the `~matplotlig.gridspec.SubplotSpec` - must be derived from the `~ultraplot.gridspec.GridSpec` used in previous calls. + must be derived from the :class:`~ultraplot.gridspec.GridSpec` used in previous calls. These restrictions arise because we allocate a single, unique `~Figure.gridspec` for each figure. @@ -2010,7 +2010,7 @@ def _iter_axes(self, hidden=False, children=False, panels=True): @property def gridspec(self): """ - The single `~ultraplot.gridspec.GridSpec` instance used for all + The single :class:`~ultraplot.gridspec.GridSpec` instance used for all subplots in the figure. See also @@ -2031,7 +2031,7 @@ def gridspec(self, gs): @property def subplotgrid(self): """ - A `~ultraplot.gridspec.SubplotGrid` containing the numbered subplots in the + A :class:`~ultraplot.gridspec.SubplotGrid` containing the numbered subplots in the figure. The subplots are ordered by increasing `~ultraplot.axes.Axes.number`. See also diff --git a/ultraplot/gridspec.py b/ultraplot/gridspec.py index 105f90c33..d1531b657 100644 --- a/ultraplot/gridspec.py +++ b/ultraplot/gridspec.py @@ -55,7 +55,7 @@ fixes the space between columns 1 and 2 but lets the tight layout algorithm determine the space between columns 2 and 3. wratios, hratios : float or sequence, optional - Passed to `~ultraplot.gridspec.GridSpec`, denotes the width and height + Passed to :class:`~ultraplot.gridspec.GridSpec`, denotes the width and height ratios for the subplot grid. Length of `wratios` must match the number of columns, and length of `hratios` must match the number of rows. width_ratios, height_ratios @@ -1646,7 +1646,7 @@ def figure(self): @property def gridspec(self): """ - The `~ultraplot.gridspec.GridSpec` uniquely associated with this `SubplotGrid`. + The :class:`~ultraplot.gridspec.GridSpec` uniquely associated with this `SubplotGrid`. This is used to resolve 2D indexing. See `~SubplotGrid.__getitem__` for details. See also @@ -1665,7 +1665,7 @@ def gridspec(self): @property def shape(self): """ - The shape of the `~ultraplot.gridspec.GridSpec` associated with the grid. + The shape of the :class:`~ultraplot.gridspec.GridSpec` associated with the grid. See `~SubplotGrid.__getitem__` for details. See also diff --git a/ultraplot/internals/rcsetup.py b/ultraplot/internals/rcsetup.py index 36f8f3bbb..91a2e9266 100644 --- a/ultraplot/internals/rcsetup.py +++ b/ultraplot/internals/rcsetup.py @@ -1108,8 +1108,8 @@ def copy(self): 64, _validate_int, "Native `~matplotlib.colors.ListedColormap`\\ s with more colors than " - "this are converted to `~ultraplot.colors.ContinuousColormap` rather than " - "`~ultraplot.colors.DiscreteColormap`. This helps translate continuous " + "this are converted to :class:`~ultraplot.colors.ContinuousColormap` rather than " + ":class:`~ultraplot.colors.DiscreteColormap`. This helps translate continuous " "colormaps from external projects.", ), "cmap.lut": ( diff --git a/ultraplot/ui.py b/ultraplot/ui.py index 84a40dcf0..7fb66334e 100644 --- a/ultraplot/ui.py +++ b/ultraplot/ui.py @@ -189,7 +189,7 @@ def subplots(*args, **kwargs): """ Return a figure and an arbitrary grid of subplots. This command is analogous to `matplotlib.pyplot.subplots`, - except the subplots are stored in a `~ultraplot.gridspec.SubplotGrid`. + except the subplots are stored in a :class:`~ultraplot.gridspec.SubplotGrid`. Parameters ---------- @@ -207,7 +207,7 @@ def subplots(*args, **kwargs): fig : `ultraplot.figure.Figure` The figure instance. axs : `ultraplot.gridspec.SubplotGrid` - The axes instances stored in a `~ultraplot.gridspec.SubplotGrid`. + The axes instances stored in a :class:`~ultraplot.gridspec.SubplotGrid`. See also --------