Skip to content

Commit 8f2fe0c

Browse files
committed
Add equal plot scales
1 parent 92b213a commit 8f2fe0c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

climada/util/plot.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ def geo_bin_from_array(array_sub, geo_coord, var_name, title, pop_name=True,
6262

6363
if 'cmap' not in kwargs:
6464
kwargs['cmap'] = 'Wistia'
65+
if 'vmin' not in kwargs:
66+
if ignore_zero:
67+
kwargs['vmin'] = np.min(array_sub[array_sub > 0])
68+
else:
69+
kwargs['vmin'] = np.min(array_sub)
70+
if 'vmax' not in kwargs:
71+
kwargs['vmax'] = np.max(array_sub)
6572

6673
# Generate each subplot
6774
fig, axis_sub = make_map(num_im)
@@ -70,7 +77,7 @@ def geo_bin_from_array(array_sub, geo_coord, var_name, title, pop_name=True,
7077
if coord.shape[0] != array_im.size:
7178
raise ValueError("Size mismatch in input array: %s != %s." % \
7279
(coord.shape[0], array_im.size))
73-
if ignore_zero:
80+
if ignore_zero and 0 in array_im:
7481
pos_vals = array_im > 0
7582
array_im = array_im[pos_vals]
7683
coord = coord[pos_vals, :]

0 commit comments

Comments
 (0)