diisplay bugfix
This commit is contained in:
+18
-7
@@ -95,26 +95,37 @@ def streamplot(ax, map_h, map_v, extent, **kwargs):
|
||||
ax.streamplot(hh, vv, map_h, map_v, **kwargs)
|
||||
|
||||
|
||||
def quiver(ax, map_h, map_v, extent, key_v=None, label="", **kwargs):
|
||||
def quiver(ax, map_h, map_v, extent, key_v=None, lognorm=False, label="", **kwargs):
|
||||
|
||||
hh, vv = gethv(map_h, map_v, extent)
|
||||
|
||||
# plot vector field
|
||||
vec_field = ax.quiver(hh, vv, map_h, map_v, units="width", **kwargs)
|
||||
|
||||
# get norm information
|
||||
norm_v = np.sqrt(map_h ** 2 + map_v ** 2)
|
||||
max_v = np.max(norm_v)
|
||||
min_v = np.min(norm_v)
|
||||
# add vector key
|
||||
|
||||
if key_v is None:
|
||||
key_v = (max_v + min_v) / 2.0
|
||||
key_v = (max_v + min_v) / 2.0
|
||||
|
||||
key = f"${key_v:g}$ {label}"
|
||||
|
||||
if lognorm:
|
||||
lognorm_v = np.log10(norm_v)
|
||||
map_h *= lognorm_v/norm_v
|
||||
map_v *= lognorm_v/norm_v
|
||||
key_v = np.log10(key_v)
|
||||
|
||||
|
||||
# plot vector field
|
||||
vec_field = ax.quiver(hh, vv, map_h, map_v, units="width", **kwargs)
|
||||
|
||||
# add vector key
|
||||
ax.quiverkey(
|
||||
vec_field,
|
||||
0.6,
|
||||
0.98,
|
||||
key_v,
|
||||
f"${key_v:g}$ {label}",
|
||||
key,
|
||||
labelpos="E",
|
||||
coordinates="figure",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user