We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I'm trying to plot a circle shape background using contextily. I see it is easy to clip the pcolormesh result like below.
pcolormesh
I'm curious if there's any similar method of clip_path for contextily?
clip_path
import matplotlib.pyplot as plt import cartopy.crs as ccrs import numpy as np import matplotlib import contextily as cx fig, ax = plt.subplots(figsize=(5, 5), subplot_kw={'projection':ccrs.PlateCarree()} ) dx, dy = 0.05, 0.05 # generate 2 2d grids for the x & y bounds y, x = np.mgrid[slice(1, 5 + dy, dy), slice(1, 5 + dx, dx)] z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x) theta = np.linspace(0, 2*np.pi, 400) center, radius = [0.5, 0.5], 0.5 verts = np.vstack([np.sin(theta), np.cos(theta)]).T circle = matplotlib.path.Path(verts * radius + center) im = ax.pcolormesh(x, y, z, cmap='viridis', clip_path=(circle, ax.transAxes)) ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, linewidth=2, color='gray', alpha=0.5, linestyle='--')
The text was updated successfully, but these errors were encountered:
I figured out how to do that and posted it on stackoverflow.
Sorry, something went wrong.
No branches or pull requests
Hi, I'm trying to plot a circle shape background using contextily. I see it is easy to clip the
pcolormesh
result like below.I'm curious if there's any similar method of
clip_path
for contextily?The text was updated successfully, but these errors were encountered: