fix labels warning, fix cbar extend warning

For the contourf function (last code block) the extend='both' parameter has to be passed into the contourf() function and removed from the colorbar() function in order to work and to not get a warning.
This commit is contained in:
srcarter3 2020-09-04 10:47:37 -06:00 committed by GitHub
parent 19bab374b9
commit 2e29d3b5ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -944,7 +944,7 @@
" ax.set_extent(bbox)\n", " ax.set_extent(bbox)\n",
" ax.coastlines(resolution='50m')\n", " ax.coastlines(resolution='50m')\n",
" gl = ax.gridlines(draw_labels=True)\n", " gl = ax.gridlines(draw_labels=True)\n",
" gl.xlabels_top = gl.ylabels_right = False\n", " gl.top_labels = gl.right_labels = False\n",
" gl.xformatter = LONGITUDE_FORMATTER\n", " gl.xformatter = LONGITUDE_FORMATTER\n",
" gl.yformatter = LATITUDE_FORMATTER\n", " gl.yformatter = LATITUDE_FORMATTER\n",
" return fig, ax\n", " return fig, ax\n",
@ -987,8 +987,8 @@
"source": [ "source": [
"fig2, ax2 = make_map(bbox=bbox)\n", "fig2, ax2 = make_map(bbox=bbox)\n",
"cs2 = ax2.contourf(lons, lats, data, 80, cmap=cmap,\n", "cs2 = ax2.contourf(lons, lats, data, 80, cmap=cmap,\n",
" vmin=data.min(), vmax=data.max())\n", " vmin=data.min(), vmax=data.max(), extend='both')\n",
"cbar2 = fig2.colorbar(cs2, extend='both', shrink=0.5, orientation='horizontal')\n", "cbar2 = fig2.colorbar(cs2, shrink=0.5, orientation='horizontal')\n",
"cbar2.set_label(grid.getLocationName() +\" \" + grid.getLevel() + \" \" \\\n", "cbar2.set_label(grid.getLocationName() +\" \" + grid.getLevel() + \" \" \\\n",
" + grid.getParameter() + \" (\" + grid.getUnit() + \") \" \\\n", " + grid.getParameter() + \" (\" + grid.getUnit() + \") \" \\\n",
" + \"valid \" + str(grid.getDataTime().getRefTime()))" " + \"valid \" + str(grid.getDataTime().getRefTime()))"