-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Hi all,
(very quiet here, is MTPy still developed?)
there seems to be a bug when plotting phase tensor ellipses using the skew angle (beta) with the 'skew_seg' colours.
BUG: negative angles don't get correctly mapped into the assigned color segments
Here is the relevant code in sub get_plot_color in module mtcolors.py:
for bb in range(bounds.shape[0]):
if colorx >= bounds[bb] and colorx < bounds[bb+1]:
cvar = float(bounds[bb])/bounds.max()
return get_color(cvar, cmap) for negative value bounds[bb] is the upper bracket, which however should be the lower bracket.
Proposed solution - use positive values and multiply with the original sign (not thoroughly tested!)
# Get the sign of the skew angle:
skew_sign = np.sign(colorx)
# New variable to work with
abs_color = np.abs(colorx)
# Use original code, start with angles outside given range:
if abs_color > bounds.max():
# Restore sign here:
cvar = skew_sign*1.0
return get_color(cvar, cmap)
# Take care of angles in interval:
for bb in range(bounds.shape[0]):
if abs_color >= bounds[bb] and abs_color < bounds[bb+1]:
# Restore sign here:
cvar = skew_sign*float(bounds[bb])/bounds.max()
return get_color(cvar, cmap) Cheers
-Ralf
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels