Giter Club home page Giter Club logo

Comments (2)

lukelbd avatar lukelbd commented on May 21, 2024 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.

bradyrx avatar bradyrx commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.