Skip to content

Commit 158b1d8

Browse files
Add shapes argument to geo_im_from_array() in climada.util.plot (#805)
* Add shapes arguement to geo_im_from_array() to enable flexible turn on/off coastline * add author in AUTHORS.md * add changes to CHANGELOG.md * changelog: moved 805 from added to changed --------- Co-authored-by: emanuel-schmid <[email protected]>
1 parent 8c8ee96 commit 158b1d8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
* Raphael Portmann
3030
* Nicolas Colombi
3131
* Leonie Villiger
32+
* Kam Lam Yeung

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Code freeze date: YYYY-MM-DD
1414

1515
### Changed
1616

17+
- Add `shapes` argument to `geo_im_from_array` to allow flexible turning on/off of plotting coastline in `plot_intensity`. [#805](https://github.com/CLIMADA-project/climada_python/pull/805)
1718
- Update `CONTRIBUTING.md` to better explain types of contributions to this repository [#797](https://github.com/CLIMADA-project/climada_python/pull/797)
1819
- The default tile layer in Exposures maps is not Stamen Terrain anymore, but [CartoDB Positron](https://github.com/CartoDB/basemap-styles). Affected methods are `climada.engine.Impact.plot_basemap_eai_exposure`,`climada.engine.Impact.plot_basemap_impact_exposure` and `climada.entity.Exposures.plot_basemap`. [#798](https://github.com/CLIMADA-project/climada_python/pull/798)
1920

climada/util/plot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def _plot_scattered_data(method, array_sub, geo_coord, var_name, title,
251251

252252

253253
def geo_im_from_array(array_sub, coord, var_name, title,
254-
proj=None, smooth=True, axes=None, figsize=(9, 13), adapt_fontsize=True,
254+
proj=None, smooth=True, shapes=True, axes=None, figsize=(9, 13), adapt_fontsize=True,
255255
**kwargs):
256256
"""Image(s) plot defined in array(s) over input coordinates.
257257
@@ -272,6 +272,9 @@ def geo_im_from_array(array_sub, coord, var_name, title,
272272
coordinate reference system used in coordinates, by default None
273273
smooth : bool, optional
274274
smooth plot to RESOLUTIONxRESOLUTION, by default True
275+
shapes : bool, optional
276+
Overlay Earth's countries coastlines to matplotlib.pyplot axis.
277+
The default is True
275278
axes : Axes or ndarray(Axes), optional
276279
by default None
277280
figsize : tuple, optional
@@ -349,7 +352,8 @@ def geo_im_from_array(array_sub, coord, var_name, title,
349352
extent[2], extent[3]), crs=proj)
350353

351354
# Add coastline to axis
352-
add_shapes(axis)
355+
if shapes:
356+
add_shapes(axis)
353357
# Create colormesh, colorbar and labels in axis
354358
cbax = make_axes_locatable(axis).append_axes('right', size="6.5%",
355359
pad=0.1, axes_class=plt.Axes)

0 commit comments

Comments
 (0)