Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
0422fbb
Initial pull request
lukelbd Sep 18, 2019
baabc93
Merge pull request #55 from lukelbd/2dlatlon-bug
lukelbd Oct 21, 2019
dc48320
Construct base class skeletons and add folder search funcs
lukelbd Oct 22, 2019
8a4956e
Move config files and standardize searching locations
lukelbd Oct 24, 2019
8addbd0
Code quality changes
lukelbd Oct 24, 2019
b48f147
Cleanup, flesh out base classes
lukelbd Oct 25, 2019
a64a18e
Default transform bugfix
lukelbd Oct 25, 2019
473c489
Define wrappers on BasemapAxes for consistency with CartopyAxes
lukelbd Oct 25, 2019
9b720aa
Update docs regarding .proplotrc
lukelbd Oct 25, 2019
3bffca3
Update rcdocs
lukelbd Oct 25, 2019
4425813
Merge branch 'master' into custom-cmaps-cycles
lukelbd Oct 25, 2019
e9b2bea
Implement colormap modifying features on classes
lukelbd Oct 28, 2019
771dddb
Cleanup
lukelbd Oct 28, 2019
d6cd771
Revert to old config file/folder layout
lukelbd Oct 28, 2019
42ef8c2
Fill default ~/.proplotrc file with commented out lines
lukelbd Oct 28, 2019
f835850
Rename rc categories
lukelbd Oct 28, 2019
f11c283
Cleanup
lukelbd Oct 28, 2019
33e384c
Rename rc dicts again
lukelbd Oct 28, 2019
1203055
Rename Colormap.copy() --> from_cmap(), cleanup
lukelbd Oct 28, 2019
4b6d1a5
Bugfix
lukelbd Oct 28, 2019
47dd70f
Segmentdata bugs
lukelbd Oct 28, 2019
fab23de
Cleanup and standardize names
lukelbd Oct 29, 2019
5974268
Make concatenate + copy non-static, misc bugfixes
lukelbd Oct 29, 2019
fd420c6
Remove duplicate reverse features, more misc bugfixes
lukelbd Oct 29, 2019
ceb98fd
Various bugfixes (from testing colors.ipynb)
lukelbd Oct 29, 2019
683c6d7
Address codacy complaints
lukelbd Oct 29, 2019
49ef944
Update docs, fix save methods, add __repr__
lukelbd Oct 29, 2019
a4b9b6d
Fix save() bug, tweak __repr__()
lukelbd Oct 30, 2019
fd79457
Unused import
lukelbd Oct 30, 2019
31439dd
Merge pull request #57 from lukelbd/custom-cmaps-cycles
lukelbd Oct 30, 2019
0fe3bfc
Add new classes to __all__
lukelbd Oct 30, 2019
e1712e7
Repair save() docs
lukelbd Oct 30, 2019
f32e950
Fix merge conflict
lukelbd Oct 30, 2019
923f6b4
Cleanup save() extensions table
lukelbd Oct 30, 2019
704c7d3
Merge branch 'master' into dualax-factoryfunc-fixes
lukelbd Oct 30, 2019
629cf55
Typo in save() docs
lukelbd Oct 30, 2019
5ae9b22
Fix sphinx links
lukelbd Oct 30, 2019
5e61499
Plural classes
lukelbd Oct 30, 2019
26fae3b
Rename Colormap.copy --> Colormap.new, cleanup benchmarking code
lukelbd Oct 30, 2019
8984497
CmapDict docs
lukelbd Oct 30, 2019
894e454
ColorCacheDict docs
lukelbd Oct 30, 2019
89db9c0
ColorCacheDict docs
lukelbd Oct 30, 2019
200c2c9
Merge branch 'master' into dualax-factoryfunc-fixes
lukelbd Oct 30, 2019
774e7f8
Change back dualx/dualy syntax
lukelbd Oct 30, 2019
ee43c53
Fix bugs due to resetting scale at drawtime
lukelbd Oct 30, 2019
02bd8fe
Add back gridliner label warnings
lukelbd Oct 30, 2019
09ed143
Update notebooks
lukelbd Oct 30, 2019
f5eff48
Implement log/symlog formatter overrides on classes
lukelbd Oct 30, 2019
552a2a4
Merge pull request #52 from lukelbd/dualax-factoryfunc-fixes
lukelbd Oct 30, 2019
4a1247b
Use mixin _Scale class, better default dualx/y locators/formatters
lukelbd Oct 30, 2019
0ea6609
Dualx/y bugfix
lukelbd Oct 30, 2019
ef51e0f
Update cartesian axes examples
lukelbd Oct 31, 2019
a2708f6
Add ETA to README
lukelbd Oct 31, 2019
20a354c
Rename _Scale-->_ScaleBase
lukelbd Oct 31, 2019
633b0ad
Move notebooks folders
lukelbd Oct 31, 2019
53142b3
Colormap() converts input matplotlib cmaps to subclass
lukelbd Oct 31, 2019
170e51d
Remove commented out code from panels-to-parasites
lukelbd Oct 31, 2019
6e98b80
Fix CartopyAxes.text() bug
lukelbd Oct 31, 2019
b547de2
Fix lonlines bug
lukelbd Oct 31, 2019
d7430ba
Default cartopy transform bugfix
lukelbd Nov 1, 2019
9ce261b
Update geophysical data example
lukelbd Nov 1, 2019
1027fb3
Permit loading arbitrary colormap files
lukelbd Nov 6, 2019
86f35f1
Rename new() --> updated()
lukelbd Nov 11, 2019
b6fbd42
Merge branch 'master' into nbsphinx-docs
lukelbd Nov 13, 2019
56c945a
Restructure docs, add new pages
lukelbd Nov 13, 2019
f1f9c6f
Add git comments to why-proplot
lukelbd Nov 13, 2019
42d81f3
Why proplot section
lukelbd Nov 13, 2019
645ad8e
Why proplot
lukelbd Nov 15, 2019
4ca91e6
Various changes, fix Parameters tables
lukelbd Nov 16, 2019
20fb6f6
Update from stash
lukelbd Nov 16, 2019
010b1cc
Revert back to :parameters: so can list multiple params at once
lukelbd Nov 17, 2019
e285557
Add light theme stylesheet, remove unused rtd clone
lukelbd Nov 18, 2019
cda6963
Fix light theme sidebar
lukelbd Nov 18, 2019
a1e703b
Light mode final CSS edits
lukelbd Nov 18, 2019
b42fd81
Slightly darker background
lukelbd Nov 18, 2019
050e0eb
Make table colors grayscale
lukelbd Nov 18, 2019
63d1311
Contribute instructions
lukelbd Nov 18, 2019
20b4fdb
Lots of writing
lukelbd Nov 18, 2019
0e7940c
My hands are writing words
lukelbd Nov 18, 2019
d1ca33e
My hands are writing words
lukelbd Nov 18, 2019
67243e1
Initial commit of notebook files
lukelbd Nov 18, 2019
6749022
Use nbsphinx fork
lukelbd Nov 18, 2019
4a6e609
Set markdown cells to raw+RST, no more nbsphinx fork
lukelbd Nov 18, 2019
fc7747b
Travis CI
lukelbd Nov 18, 2019
45c6d5c
Link fixes, minor CSS changes, overview edits
lukelbd Nov 18, 2019
252244d
Parameter header edits
lukelbd Nov 18, 2019
d40a441
Add to quick overview, various other changes
lukelbd Nov 18, 2019
63cc63e
Links, better homepage, axistools cleanup
lukelbd Nov 19, 2019
43f7767
Quick overview and links cleanup
lukelbd Nov 19, 2019
5a53690
Split user guide notebooks into smaller sections
lukelbd Nov 19, 2019
c5e83a2
Contribution guide
lukelbd Nov 19, 2019
3288d58
proj.py docs
lukelbd Nov 19, 2019
c1f843a
API ref main page
lukelbd Nov 19, 2019
1a95106
Split up figure notebook sections
lukelbd Nov 19, 2019
4021238
Compare APIs in why-proplot, not user guide
lukelbd Nov 19, 2019
9c0781a
Split color usage notebook into 3 notebooks
lukelbd Nov 19, 2019
c12451c
Rename the axes classes
lukelbd Nov 19, 2019
c3a1aa5
Better admonition blocks, fix broken links
lukelbd Nov 19, 2019
120501c
Thinner tables, docs cleanup
lukelbd Nov 19, 2019
1060158
External links
lukelbd Nov 19, 2019
d0db1bf
Docs cleanup, add manifest, add INSTALL.rst
lukelbd Nov 20, 2019
0148841
Why proplot
lukelbd Nov 20, 2019
f28706f
Misc docs changes
lukelbd Nov 20, 2019
b270941
Fix notebook links, rename cmapline --> parametric
lukelbd Nov 20, 2019
cbb956b
Add parametric method to docs
lukelbd Nov 20, 2019
a1330ef
Fix wrapper docs links
lukelbd Nov 20, 2019
5459654
Fix sidebar colors for deeply nested entries
lukelbd Nov 20, 2019
33074ee
Figures notebook cleanup
lukelbd Nov 20, 2019
3015729
Tight layout notebook
lukelbd Nov 20, 2019
3554b57
Remove add-subplot workflow refs, fix sidebar colors/buttons
lukelbd Nov 20, 2019
7b49a86
Remove remaining add-subplot refs
lukelbd Nov 21, 2019
7b07b4a
subplots() docstring
lukelbd Nov 21, 2019
97d4ec7
Dark/light mode toggle (!), zerotrim bugfix
lukelbd Nov 24, 2019
0da79e3
API page changes
lukelbd Nov 24, 2019
a9673e5
Minor changes
lukelbd Nov 24, 2019
3f7f337
Stop documenting Circle() func
lukelbd Nov 24, 2019
4631ee7
Really fix zerotrim
lukelbd Nov 24, 2019
d3b0f0b
Faq, overview, fix links, align nbsphinx output
lukelbd Nov 24, 2019
f99fbdc
Dark/light mode toggles pygments stylesheet (!)
lukelbd Nov 24, 2019
c922439
Fix dark-light toggler
lukelbd Nov 24, 2019
bccf8d7
Use rubric:: for API page subheaders
lukelbd Nov 24, 2019
76c79e5
Style tweaks, misc changes
lukelbd Nov 24, 2019
ef7843e
Style tweaks, misc changes
lukelbd Nov 24, 2019
29ea57e
Use local pygment css files, cleanup, tweaks
lukelbd Nov 24, 2019
75ce94f
Test
lukelbd Nov 24, 2019
506c491
Larger fonts in examples, docs cleanup, custom_roles cleanup, misc bu…
lukelbd Nov 25, 2019
6b79f2f
Clean notebook output
lukelbd Nov 25, 2019
f47345d
Update contribution instructions
lukelbd Nov 25, 2019
98f9652
Fix merge conflict
lukelbd Nov 25, 2019
d6a7c5a
Stylesheet bugfixes
lukelbd Nov 25, 2019
fb64eb0
Overview, faq, why proplot
lukelbd Nov 25, 2019
8bbe050
Remove units section
lukelbd Nov 25, 2019
efb4475
Why proplot
lukelbd Nov 25, 2019
e43db85
Why proplot
lukelbd Nov 25, 2019
cebc74e
Why proplot
lukelbd Nov 25, 2019
62d94e0
Codacy complaints
lukelbd Nov 25, 2019
2c1e3e1
Why and overview
lukelbd Nov 25, 2019
6736ea6
Overview and why-proplot, split nb_setup() into 3 funcs
lukelbd Nov 26, 2019
e9e8634
Why proplot
lukelbd Nov 26, 2019
53aff70
Code qaulity, Colormap.from_list improvements, cyclic + transparent m…
lukelbd Nov 27, 2019
b08e52d
Merge branch 'master' into nbsphinx-docs
lukelbd Nov 27, 2019
1f4ba46
Physical units descrip
lukelbd Nov 27, 2019
f1d2e9d
Physical units
lukelbd Nov 27, 2019
0d5127e
Remove 'default' formatter, code quality fixes
lukelbd Nov 27, 2019
acffc34
Use setuptools_scm, no more hardcoded version / MANIFEST
lukelbd Nov 27, 2019
8743b85
Travis fix (just notebooks for now)
lukelbd Nov 27, 2019
b49f54f
Fix sphinx-build requirements
lukelbd Nov 27, 2019
ab0ca7e
Use conda for documentation build reqs
lukelbd Nov 27, 2019
c7dbcae
Fix conda activate
lukelbd Nov 27, 2019
d34d888
Fix proplot not found issue
lukelbd Nov 27, 2019
0c6d581
Bugfix (travis caught it! awesome!)
lukelbd Nov 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Why proplot
  • Loading branch information
lukelbd committed Nov 26, 2019
commit e9e863444a93cd289f982f713847b3fbbfd46f6a
89 changes: 56 additions & 33 deletions docs/why.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,45 @@ Constructor functions

<h3>Problem</h3>

Matplotlib and cartopy introduce a bunch of classes with verbose names like `~matplotlib.ticker.MultipleLocator`, `~matplotlib.ticker.FormatStrFormatter`, `~cartopy.crs.AlbersEqualArea`, and `~cartopy.crs.NorthPolarStereo`.
But matplotlib `axis scales <https://matplotlib.org/3.1.0/gallery/scales/scales.html>`__ and `colormaps <https://matplotlib.org/3.1.1/gallery/color/colormap_reference.html>`__ are **registered** under string names, as are `map projections <https://matplotlib.org/basemap/users/mapsetup.html>`__ in basemap. So why not register other verbose class names too?
Matplotlib and cartopy introduce a bunch of classes with verbose names like `~matplotlib.ticker.MultipleLocator`, `~matplotlib.ticker.FormatStrFormatter`, and
`~cartopy.crs.LambertAzimuthalEqualArea`. Since plotting code has a half life of about 30 seconds, typing out all of these extra class names and import statements can be a *major* drag.

*Other* parts of the matplotlib API were designed with this in mind.
`Native axes projections <https://matplotlib.org/3.1.1/api/projections_api.html>`__,
`axis scale classes <https://matplotlib.org/3.1.0/gallery/scales/scales.html>`__, and `colormap instances <https://matplotlib.org/3.1.1/gallery/color/colormap_reference.html>`__ are referenced with "registered" string names,
as are `basemap projection types <https://matplotlib.org/basemap/users/mapsetup.html>`__.
If these are already "registered", why not "register" everything else?

.. raw:: html

<h3>Solution</h3>

In ProPlot, tick locators, tick formatters, axis scales, cartopy projections, colormaps, and property cyclers are all **registered**. This is done by creating **constructor functions** and passing various keyword argument through the functions, allowing users to use class names instead of instances.

This may seem "unpythonic" but it is absolutely invaluable when making plots. Plotting code has a half life of about 30 seconds, and typing out all of these extra class names and import statements gets to be a major drag.

The below table lists the constructor functions and the keyword arguments that use them.

============================== ============================= ================================================================================================================================================================================================
Function Returns Interpreted by
============================== ============================= ================================================================================================================================================================================================
`~proplot.axistools.Locator` Axis locator ``locator=``, ``xlocator=``, ``ylocator=``, ``minorlocator=``, ``xminorlocator=``, ``yminorlocator=``, ``ticks=``, ``xticks=``, ``yticks=``, ``minorticks=``, ``xminorticks=``, ``yminorticks=``
`~proplot.axistools.Formatter` Axis formatter ``formatter=``, ``xformatter=``, ``yformatter=``, ``ticklabels=``, ``xticklabels=``, ``yticklabels=``
`~proplot.axistools.Scale` Axis scale ``xscale=``, ``yscale=``
`~proplot.styletools.Colormap` Colormap ``cmap=``
`~proplot.styletools.Cycle` Property cycler ``cycle=``
`~proplot.styletools.Norm` Colormap normalizer ``norm=``
`~proplot.projs.Proj` Cartopy or basemap projection ``proj=``
============================== ============================= ================================================================================================================================================================================================
In ProPlot, tick locators, tick formatters, axis scales, cartopy projections, colormaps, and property cyclers are all "registered". This is done by creating several **constructor functions** and passing various keyword argument *through* the constructor functions.
This may seem "unpythonic" but it is absolutely invaluable when making plots.

The constructor functions also accept *other* types of input: For
example, scalar numbers passed to `~proplot.axistools.Locator` returns
a `~matplotlib.ticker.MultipleLocator` instance, lists of strings passed
to `~proplot.axistools.Formatter` returns a `~matplotlib.ticker.FixedFormatter` instance, and `~proplot.styletools.Colormap` and `~proplot.styletools.Cycle` accept all kinds of input. And if an instance of the corresponding class is passed to any constructor function, it is simply returned. See :ref:`X and Y axis settings`, :ref:`Colormaps`, and :ref:`Color cycles` for details.

The below table lists the constructor functions and the keyword arguments that
use them.

============================== ============================================================ ============================================================= =================================================================================================================================================================================================
Function Returns Interpreted by Keyword argument(s)
============================== ============================================================ ============================================================= =================================================================================================================================================================================================
`~proplot.axistools.Locator` Axis `~matplotlib.ticker.Locator` `~proplot.axes.Axes.format` and `~proplot.axes.Axes.colorbar` ``locator=``, ``xlocator=``, ``ylocator=``, ``minorlocator=``, ``xminorlocator=``, ``yminorlocator=``, ``ticks=``, ``xticks=``, ``yticks=``, ``minorticks=``, ``xminorticks=``, ``yminorticks=``
`~proplot.axistools.Formatter` Axis `~matplotlib.ticker.Formatter` `~proplot.axes.Axes.format` and `~proplot.axes.Axes.colorbar` ``formatter=``, ``xformatter=``, ``yformatter=``, ``ticklabels=``, ``xticklabels=``, ``yticklabels=``
`~proplot.axistools.Scale` Axis `~matplotlib.scale.ScaleBase` `~proplot.axes.Axes.format` ``xscale=``, ``yscale=``
`~proplot.styletools.Colormap` `~matplotlib.colors.Colormap` instance Various plotting methods ``cmap=``
`~proplot.styletools.Cycle` Property `~cycler.Cycler` Various plotting methods ``cycle=``
`~proplot.styletools.Norm` `~matplotlib.colors.Normalize` instance Various plotting methods ``norm=``
`~proplot.projs.Proj` `~cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap` `~proplot.subplots.subplots` ``proj=``
============================== ============================================================ ============================================================= =================================================================================================================================================================================================

Note that `~matplotlib.axes.Axes.set_xscale` and `~matplotlib.axes.Axes.set_yscale`
now accept instances of `~matplotlib.scale.ScaleBase` thanks to a monkey patch
applied by ProPlot.

Automatic dimensions and spacing
================================
Expand Down Expand Up @@ -187,6 +202,7 @@ unifies the behavior of the three possible `matplotlib.pyplot.subplots` return v
* `~proplot.subplots.axes_grid` supports row-major or column-major 1D indexing, e.g. ``axs[0]``. The order can be changed by passing ``order='F'`` or ``order='C'`` to `~proplot.subplots.subplots`.
* `~proplot.subplots.axes_grid` permits 2D indexing, e.g. ``axs[1,0]``. Since `~proplot.subplots.subplots` can generate figures with arbitrarily complex subplot geometry, this 2D indexing is useful only when the arrangement happens to be a clean 2D matrix.

See :ref:`Creating figures` for details.

..
This goes with ProPlot's theme of preserving the object-oriented spirit, but making things easier for users.
Expand All @@ -208,12 +224,14 @@ This approach is not ideal -- plotting methods should be invoked on the `~proplo

<h3>Solution</h3>

ProPlot *reproduces* most of the `xarray.DataArray.plot`, `pandas.DataFrame.plot`, and `pandas.Series.plot` features on the `~proplot.axes.Axes` methods themselves! Axis tick labels, axis labels, subplot titles, and colorbar and legend labels are automatically applied
ProPlot *reproduces* most of the `xarray.DataArray.plot`, `pandas.DataFrame.plot`, and `pandas.Series.plot` features on the `~proplot.axes.Axes` methods themselves!

Axis tick labels, axis labels, subplot titles, and colorbar and legend labels are automatically applied
when a `~xarray.DataArray`, `~pandas.DataFrame`, or `~pandas.Series` is passed through
a plotting method instead of a `~numpy.ndarray`.
This is accomplished by passing positional arguments through the
`~proplot.wrappers.standardize_1d` and `~proplot.wrappers.standardize_2d`
wrappers.
wrappers. See :ref:`1d plotting` and :ref:`2d plotting` for details.

Various plotting improvements
=============================
Expand Down Expand Up @@ -302,13 +320,15 @@ overrides various plotting methods:
See :ref:`Geographic and polar plots` for details.

Note that active development on basemap will `halt after 2020 <https://matplotlib.org/basemap/users/intro.html#cartopy-new-management-and-eol-announcement>`__.
This is the right decision: Cartopy is integrated more closely with the matplotlib API
and is more amenable to further development. For now, cartopy is
For now, cartopy is
`missing several features <https://matplotlib.org/basemap/api/basemap_api.html#module-mpl_toolkits.basemap>`__
offered by basemap -- namely, flexible meridian and parallel gridline labels,
drawing physical map scales, and convenience features for adding background images like
the "blue marble". But once these are added to cartopy, ProPlot may remove the `~mpl_toolkits.basemap` integration features.

..
This is the right decision: Cartopy is integrated more closely with the matplotlib API
and is more amenable to further development.

Colormaps and property cycles
=============================
Expand All @@ -330,7 +350,7 @@ They are hard to edit and hard to create from scratch.
In ProPlot, it is easy to manipulate colormaps and property cycles:

* The `~proplot.styletools.Colormap` constructor function can be used to slice and merge existing colormaps and/or generate brand new ones.
* The `~proplot.styletools.Cycle` constructor function can be used to make *color cycles* from *colormaps*! These cycles can be applied by passing th e`cycle` keyword argument to plotting commands or changing the :rcraw:`cycle` setting. See :ref:`Color cycles` for details.
* The `~proplot.styletools.Cycle` constructor function can be used to make *color cycles* from *colormaps*! These cycles can be applied by passing the `cycle` keyword argument to plotting commands or changing the :rcraw:`cycle` setting. See :ref:`Color cycles` for details.
* The new `~proplot.styletools.ListedColormap` and `~proplot.styletools.LinearSegmentedColormap` classes include several new methods, e.g. `~proplot.styletools.LinearSegmentedColormap.save` and `~proplot.styletools.LinearSegmentedColormap.concatenate`, and have a much nicer REPL representation.
* The `~proplot.styletools.PerceptuallyUniformColormap` class is used to make :ref:`Perceptually uniform colormaps`. These have smooth, aesthetically pleasing color transitions represent your data *accurately*.

Expand All @@ -345,7 +365,10 @@ Smarter colormap normalization
In matplotlib, when ``extend='min'``, ``extend='max'``, or ``extend='neither'`` is passed to `~matplotlib.figure.Figure.colorbar` , colormap colors reserved for "out-of-bounds" values are truncated.

The problem is that matplotlib discretizes colormaps by generating a low-resolution lookup table (see `~matplotlib.colors.LinearSegmentedColormap` for details).
This approach cannot be fine-tuned, creates an unnecessary copy of the colormap, and prevents you from using the resulting colormap for plots with different numbers of levels.
This approach cannot be fine-tuned and creates an unnecessary copy of the colormap.

..
and prevents you from using the resulting colormap for plots with different numbers of levels.

It is clear that the task discretizing colormap colors should be left to the **normalizer**, not the colormap itself. Matplotlib provides `~matplotlib.colors.BoundaryNorm` for this purpose, but it is seldom used and its features are limited.

Expand Down Expand Up @@ -376,11 +399,11 @@ ProPlot comes packaged with several additional fonts. The new default font is He

ProPlot adds fonts to matplotlib by making use of a completely undocumented feature: the ``$TTFPATH`` environment variable (matplotlib adds ``.ttf`` and ``.otf`` font files from folders listed in ``$TTFPATH``). You can also use *your own* font files by dropping them in ``~/.proplot/fonts``.

...and much more!
=================

This page is not comprehensive -- it just
illustrates how ProPlot addresses
some of the stickiest matplotlib limitations
that bug your average power user.
See the User Guide for a more comprehensive overview.
..
...and much more!
=================
This page is not comprehensive -- it just
illustrates how ProPlot addresses
some of the stickiest matplotlib limitations
that bug your average power user.
See the User Guide for a more comprehensive overview.