Comments (2)
Thanks for posting this, it triggered a much-needed cleanup of cmap_wrapper
(commit 42ec0be). Details are in the cmap_wrapper
documentation. Try this new example:
import proplot as plot
import xarray as xr
import numpy as np
%matplotlib inline
ds = xr.open_dataarray('/Users/ldavis/tmp/chl_cal.nc')
f, ax = plot.subplots(proj='pcarree', tight=False, axwidth=6, colorbar='r')
p = ax.pcolormesh(ds.lon, ds.lat, ds.values, norm='log', levels=15)
# p = ax.contourf(ds.lon, ds.lat, ds.values, norm='log', levels=15) # also works!
ax.set_extent([-140, -105, 20, 50])
f.rightpanel.colorbar(p)
Now the pcolor
level selection behavior is like the matplotlib contourf
selection behavior -- boundaries are "nice" by default (uses matplotlib.ticker.MaxNLocator
). And now you can have nicely-spaced levels in plots with logarithmically-scaled colormaps, which was always really tricky to do in matplotlib. Note that setting vmin
and vmax
to the data minimum and maximum isn't really necessary.
By the way it looks like you still have that issue with thin fonts? If you run
rm ~/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/Helvetica*
and restart IPython it should fix the issue. Font control in matplotlib is really tricky, for now I have to add font files directly to the matplotlib data folder but am considering changing this.
Also keep in mind one of the big things with ProPlot is you no longer have to refer to these verbose class names (e.g. matplotlib.colors.LogNorm
) -- everything is registered just like axis scale names or basemap projection names, including colormap Normalizers, Locators, Formatters, and cartopy projections. This is less verbose, fewer import statements, etc. This point is now emphasized in the README.
And now I'm going to sleep.
from proplot.
This is awesome, thanks @lukelbd. Resulting plot from this update is going on my poster I'm working on. Thanks also for the cmap_wrapper
documentation. I didn't realize I could just pass arguments directly from there into pcolor
, etc.
from proplot.
Related Issues (20)
- 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
- May I ask how to import. shp format files into proplot HOT 1
- Set markercolor for scatter plots with a substring from another columns using .map() and colordict HOT 1
- Change the 'N' notation by decimal lat/lon degrees HOT 2
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.