Comments (5)
Fixing this one was crazy. It turns out that this artifact is related to this particular dataset and occurs in matplotlib normally, but cartopy patches that error in some complex and mysterious way, but I was doing something that ruined cartopy's patch. Try these examples after updating (the s
is just to make the dataset smaller):
import matplotlib.pyplot as plt
import proplot as plot
import climpred as cp
s = 2
# Load data
data = cp.tutorial.load_dataset('MPI-control-3D')
data = data.isel(time=0).tos
# Does not generate artifact
f, ax = plot.subplots(width=5, proj='pcarree', axcolorbar='r')
ax.pcolormesh(data.lon[::s,::s], data.lat[::s,::s], data[::s,::s], levels=20, colorbar='r')
# Basemap, generates artifact
# f, ax = plot.subplots(width=5, basemap=True, proj='pcarree', axcolorbar='r')
# ax.pcolormesh(data.lon[::s,::s], data.lat[::s,::s], data[::s,::s], levels=20, colorbar='r')
# On Cartesian axes/without projection, generates artifact
# f, ax = plot.subplots(width=5, axcolorbar='r')
# ax.pcolor(data.lon[::s,::s], data.lat[::s,::s], data[::s,::s], levels=20, colorbar='r')
# With pyplot, generates artifact
# f, ax = plt.subplots()
# ax.pcolor(data.lon[::s,::s], data.lat[::s,::s], data[::s,::s])
The cartopy patch evidently works by masking content in your data array. My BinNorm
normalizer that I apply to all colormap objects was deleting/ignoring this mask (see the ma.getmaskarray
lines in commit 222392e).
Also the latest ProPlot versions fix the weird font bug we came across the other day. It had to do with me adding a font .ttf
file with a style unrecognized by matplotlib/that matplotlib interpreted as 'normal'
.
I also added your polar projection zoom-ins to getting started, fixed a tight-layout bug that appeard with zoomed-in projections, fixed a bug related to the circular bounding box limits, fixed a bug where the facecolor
attribute for map axes would get reset, added the 'nplaea'
, 'splaea'
, 'npaeqd'
, and 'spaeqd'
projections to cartopy like in basemap, and various other bugfixes/cleanup tasks. It's all a blur.
Still just pushing to master at will.... will get into your workflow once I set up CI with some smaller tests.
from proplot.
Also thanks for posting this issue. It definitely needed to be fixed and would probably have appeared mysteriously for various other users with various other datasets. I was exhausted when I posted this.
from proplot.
@lukelbd
Awesome, thanks for all the updates here. So in summary, only use the cartopy projection format for these 2D maps? Looks like all the other options (including Basemap) generate those artifacts.
from proplot.
Yep that's right. My guess is it has to do with your data graticule crossing the edge of the map; cartopy takes pains to fix issues associated with stuff running over the map edge.
from proplot.
Having the Greenland-pole grid on the ocean always causes issues. With 2D lat/lon you can't really contour properly. I'm used to these problems, but they shouldn't occur on pcolormesh
. Glad you were able to fix it!
from proplot.
Related Issues (20)
- 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
- Support matplotlib >= 3.6.0 HOT 3
- Migrate proplot repo to be housed under another open-source development group? HOT 5
- how to install? HOT 2
- Issue importing proplot 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.