Skip to content

Commit

Permalink
fix method notebook plots (SciTools/cartopy#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause committed Sep 8, 2021
1 parent 7ff45d6 commit c7c6331
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/notebooks/method.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@
"metadata": {},
"outputs": [],
"source": [
"cmap1 = mplc.ListedColormap([\"#9ecae1\"])\n",
"cmap2 = mplc.ListedColormap([\"#fc9272\"])\n",
"cmap3 = mplc.ListedColormap([\"#cab2d6\"])\n",
"color1 = \"#9ecae1\"\n",
"color2 = \"#fc9272\"\n",
"color3 = \"#cab2d6\"\n",
"\n",
"cmap_2col = mplc.ListedColormap([\"#9ecae1\", \"#fc9272\"])"
"cmap1 = mplc.ListedColormap([color1])\n",
"cmap2 = mplc.ListedColormap([color2])\n",
"cmap3 = mplc.ListedColormap([color3])"
]
},
{
Expand Down Expand Up @@ -368,7 +370,9 @@
"opt = dict(add_colorbar=False, ec=\"0.3\", lw=0.5, transform=ccrs.PlateCarree())\n",
"\n",
"ax = axes[0]\n",
"mask_global_nontreat.plot(ax=ax, cmap=cmap1, **opt)\n",
"# work around for SciTools/cartopy/issues/1845\n",
"mask_global_nontreat = mask_global_nontreat.fillna(1)\n",
"mask_global_nontreat.plot(ax=ax, colors=[color1, \"none\"], levels=2, **opt)\n",
"\n",
"# only for the gridlines\n",
"mask_global.plot(ax=ax, colors=[\"none\"], levels=1, **opt)\n",
Expand Down Expand Up @@ -435,7 +439,9 @@
"\n",
"ax.plot(LON, LAT, \"o\", color=\"0.3\", ms=2, transform=ccrs.PlateCarree(), zorder=5)\n",
"\n",
"mask_global_2regions.plot(ax=ax, cmap=cmap_2col, **opt)\n",
"# work around for SciTools/cartopy/issues/1845\n",
"mask_global_2regions = mask_global_2regions.fillna(2)\n",
"mask_global_2regions.plot(ax=ax, colors=[color1, color2, \"none\"], levels=3, **opt)\n",
"# only for the gridlines\n",
"mask_global.plot(ax=ax, colors=[\"none\"], levels=1, **opt)\n",
"\n",
Expand Down Expand Up @@ -594,7 +600,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c7c6331

Please sign in to comment.