Skip to content

Commit 8d519b2

Browse files
committed
add colorbar label defaults if these kwargs are not submitted to level() and amplitude()
1 parent a779b80 commit 8d519b2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sfs/plot2d.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def amplitude(p, grid, *, xnorm=None, cmap='coolwarm_clip',
319319
ax.set_xlabel(xlabel)
320320
ax.set_ylabel(ylabel)
321321
if colorbar:
322+
colorbar_kwargs.setdefault('label', 'relative pressure')
322323
add_colorbar(im, **colorbar_kwargs)
323324
return im
324325

@@ -339,6 +340,7 @@ def level(p, grid, *, xnorm=None, power=False, cmap=None, vmax=3, vmin=-50,
339340
if xnorm is not None:
340341
p = _util.normalize(p, grid, xnorm)
341342
L = _util.db(p, power=power)
343+
kwargs.setdefault('colorbar_kwargs', {'label': 'level / dB'})
342344
return amplitude(L, grid=grid, xnorm=None, cmap=cmap,
343345
vmax=vmax, vmin=vmin, **kwargs)
344346

0 commit comments

Comments
 (0)