Comments (7)
Thanks for the heads up, have never used the built-in xarray plotting commands.
Indeed I switched the names for some default colormaps because I thought 'RdBu'
was a silly convention (99.9% of the time blue is "small/negative" and red is "large/positive"). Compatibility breaks didn't occur to me. I think I'll replace the colormap dictionary (stored in matplotlib.cm.cmap_d
) with a new class that handles these naming issues -- total case insensitivity, and e.g. equivalency of 'RdBu_r'
and 'BuRd'
. Shouldn't take very long.
from proplot.
I completely agree with your thinking (and understood why you did it when I saw it). I imagine this compatibility issue would extend to any library that default plots a certain colormap like xarray.
from proplot.
Decided to just tackle this right now since I'd been meaning to do something similar anyway. Latest commit should satisfy the behavior I described (hopefully) without any side-effects, using a (probably overkill) fancy new class called _CmapDict
. See:
Try this example (after updating to the latest version):
f, axs = plot.subplots(ncols=6, axwidth=2, innercolorbars='b', innercolorbars_kw={'hspace':0.2})
for i,cmap in enumerate(('ColdHot', 'HotCold', 'HotCold_r', 'RdYlGn', 'GnYlRd', 'GnYlRd_r')):
m = axs[i].contourf(np.random.rand(10,10), cmap=cmap)
axs[i].bottompanel.colorbar(m)
Let me know if you discover any new issues and will re-open.
from proplot.
(Accidentally left a print statement in there; latest commit will have deleted it.)
from proplot.
@lukelbd, this doesn't seem to solve it on my end. Note that I did upgrade the package to the most recent commits.
Using your example I get the following error:
TypeError Traceback (most recent call last)
<ipython-input-27-9b7beea59934> in <module>
----> 1 f, axs = plot.subplots(ncols=6, axwidth=2, innercolorbars='b', innercolorbars_kw={'hspace':0.2})
2 for i,cmap in enumerate(('ColdHot', 'HotCold', 'HotCold_r', 'RdYlGn', 'GnYlRd', 'GnYlRd_r')):
3 m = axs[i].contourf(np.random.rand(10,10), cmap=cmap)
4 axs[i].bottompanel.colorbar(m)
~/Desktop/proplot/proplot/subplots.py in subplots(array, ncols, nrows, rowmajor, emptycols, emptyrows, tight, auto_adjust, rcreset, silent, span, share, spanx, spany, sharex, sharey, innerpanels, innercolorbars, innerpanels_kw, basemap, proj, projection, proj_kw, projection_kw, **kwargs)
262
263 # Create gridspec for outer plotting regions (divides 'main area' from side panels)
--> 264 figsize, offset, subplots_kw, gridspec_kw = _gridspec_kwargs(nrows, ncols, **kwargs)
265 row_offset, col_offset = offset
266 gs = FlexibleGridSpec(**gridspec_kw)
TypeError: _gridspec_kwargs() got an unexpected keyword argument 'innercolorbars_kw'
Running ds.plot() returns the same issue as before. Interestingly, I tried to run import proplot.colortools
to just check that the new Class was showing up, and get the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-30-bba849ec6737> in <module>
----> 1 import proplot.colortools
ModuleNotFoundError: No module named 'proplot.colortools'
This happens with all submodules. Not sure if you have some lock on importing submodules directly? Although not sure how one would do that. Note that import proplot
works just fine, so this is isolated to submodules.
from proplot.
Hmm, innercolorbars_kw
(which is just an alias for innerpanels_kw
) should have been added by latest commit.
The second example doesn't work because I just use the individual files to organize things (__init__.py
contains from .colortools import *; from .axistools import *; etc.
. Wanted user to have access to all commands at the top-level (without submodules).
Try accessing plot._CmapDict
; does it show anything? If not, maybe try uninstalling/re-installing. I pushed the changes.
I wonder if when you pip install
from a git URL, if the version number in setup.py
hasn't changed (which it hasn't), pip
just won't update the repo?
from proplot.
It works now... can't tell you what changed. I installed via pip and your example as well as ds.plot() on anomalies works.
from proplot.
Related Issues (20)
- unexpected minor ticks in colorbar
- Hide datetime minorticks?
- Feature request: allow a single label for a group of lines HOT 4
- add more color blind-friendly default color cycle
- bug: cannot set equal aspect for log scale HOT 1
- Support for plotting distribution with different number of samples HOT 6
- How to set the order of 'abc'? HOT 1
- Bug: xticklabels overwrites xminorticks setting HOT 3
- Cannot pass norm argument to hist2d
- Any timeline for a relase that supports matplotlib >=3.5?
- Proplot changes names of colormaps to lowercase, breaking `matplotlib.pyplot.get_cmap`
- MatplotlibDeprecationWarning with unexpected argument for savefig() HOT 3
- proplot can't plot string like datetime
- Inset_axes zooms doesn't show lines
- Trying to make a line over contourf returns TypeError HOT 5
- TypeError: tricontourf() takes 4 positional arguments but 5 were given
- Option for adding errorbar legend
- Nonsticky bounds
- How to use proplot in MATLAB HOT 1
- path effects not pretty
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proplot.