mplotutils
mplotutils copied to clipboard
hatch functions
- [x] Closes #62
- [ ] Tests added
- [ ] Passes
isort . && black . && flake8 - [ ] Fully documented, including
CHANGELOG.md
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import mplotutils as mpu
import xarray as xr
%matplotlib qt
air = xr.tutorial.open_dataset("air_temperature")
f, ax = plt.subplots()
air.air.isel(time=0).plot(ax=ax)
mpu.hatch(ax, air.air.isel(time=0) < 250, "///", "None")
plt.legend()
# ===========
f, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree()})
ax.coastlines()
air.air.isel(time=0).plot(ax=ax, transform=ccrs.PlateCarree())
mpu.hatch_regional_map(ax, air.air.isel(time=0) < 250, "///", "None", color="w")
plt.legend()