-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change land color to transparent #290
Comments
Figured it out. Use coast=True |
Cool. Your title also made me realize it might be useful to change the opacity Here's an example (below the land color is black with opacity of 20% -- you could also pass import proplot as pplt
fig = pplt.figure()
ax = fig.subplot(proj='cyl', land=True, coast=True, landalpha=0.2) |
@lukelbd ` fig = pplt.figure(figsize=(20,20)) eax, iax, dax = fig.subplots(nrows=3, proj='pcarree', land=True) em = eax.pcolorfast(ev, cmap='gist_ncar_r', vmin=0.5, vmax=50.0) eax.set_title('Eval 210930 Proxy') cbar = eax.colorbar(em, loc='b', label='dBZ', length=0.5) |
Yep the Thanks for alerting me to that That second issue is some really weird/insiduous problem with cartopy's projection transforms. Someone else emailed me with the same issue -- it's also possible to encounter this with just cartopy + matplotlib (i.e. without proplot). For now, if you try using a different map projection, or if you try tweaking the edge coordinates of your dataset (for example, setting the maximum latitude to 89 instead of 90, or setting the maximum longitude to 179 instead of 180), you should be able to fix it. But the behavior is pretty unpredictable, seems to depend on the dataset and possibly even the figure size. |
Also, just some advice, not sure I'd recommend making a 20 inch x 20 inch figure. If you're having issues with your figure showing up too small in the display window, it might be better to increase the dpi with something like |
OK. I have a conda env and doing pip install always corrupts my env. I'll wait for the release. ` for ax in [ex, ix, dx]: Plot the datashrink = 1.0 for ax, title in zip([ex, ix, dx],titles): ev.close() The above code produces the proper treatment of the dataset in this fig: Thanks for the figsize tip. |
Yeah As for the contour issue, it looks like your example with just matplotlib + cartopy might still be presenting the problem -- except your colormap is different, so the background is getting colored by white instead of light blue. I've been able to reproduce this problem in just cartopy + matplotlib, so it is indeed a cartopy problem: import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import proplot as pplt
N = 10
state = np.random.RandomState(23)
fig = plt.figure(figsize=(5, 2.5))
ax = fig.add_subplot(projection=ccrs.Mollweide())
ax.coastlines()
x = np.linspace(-180, 180, N)
y = np.linspace(-90, 90, N)
z = state.rand(N, N) * 10 - 5
m = ax.contourf(
x, y, z,
transform=ccrs.PlateCarree(),
cmap='NegPos',
vmin=-5,
vmax=5,
)
fig.colorbar(m, ax=ax) I think I'll submit a bug report to cartopy with this example. |
Turns out there's already an active cartopy issue: SciTools/cartopy#1076. I added the above example to the thread |
I would like to plot the coastlines but not to have the data over the land masked out. Can I change the land fill to transparent?
The text was updated successfully, but these errors were encountered: