## Bug #1783

### Colour 3D plot scaling differences

Status: | Closed | Start date: | 2017-01-24 | |
---|---|---|---|---|

Priority: | Normal | Due date: | ||

Assignee: | - | % Done: | 0% | |

Category: | - | |||

Target version: | - |

**Description**

There are some obvious differences in scaling between beta3.0-2a and 2.5, observed in this scenario using qm-vamp-plugins:qm-mfcc:coefficients.

Values below zero are mapped to low (presumably 0) intensities, for both log and linear scales. This is not the case in previous versions.

### History

#### #1 Updated by Chris Cannam almost 3 years ago

Log mapping behaviour for data sets that span zero, i.e. include both positive and negative values, in v2.5 and v3.0beta4:

Layer |
v2.5 |
v3.0beta4 |

Time-value | Negative values are displayed with log of absolute value. Scale displays absolute values from max down to zero. |
Same. |

Region | Negative values are displayed with log of absolute value. Scale displays absolute values from max down to zero. |
Same. |

Note | Negative-valued points disappear completely in Linear or Log scales. (They're visible in Auto-Align scale.) |
Same. |

Colour 3D Plot | Negative values are displayed with colour for log of absolute value. Scale shows colour of absolute value, i.e. is "mirrored" around zero. |
Negative values are displayed with "background" colour (generally black). Scale displays full range of values, spanning zero, with black for everything below zero. Mapped colours appear similar-ish to v2.5 for positive values. |

Spectrogram | Can't happen. | Can't happen. |

Waveform | dB scale shows log of absolute value. | Same. |

In testing this, I notice that there's a real problem with the colour 3d plot in v3.0beta4 -- it clamps all negative values to black even when **not** in a log scale! This is plainly wrong.

There's no single right answer for the log scale -- if you ask for a log scale it's fair I think to assume that the data set is intended to be representable on one, which means it's fair to assume negative values are intended to occupy some position on the scale (e.g. displaying log of their absolute values) rather than being thrown out as outliers. This leads to more confusing plots in cases where that isn't true, unfortunately, but it's not unreasonable.

The proper fix for this issue is probably to revert to the behaviour of v2.5, and of course to fix that also for the linear case in the colour 3d plot (this existence of which suggests that this is probably a simple bug rather than an artifact of some deliberate decision somewhere).

(I don't understand the Note layer case, but I also think it isn't all that high priority)

#### #2 Updated by Chris Cannam almost 3 years ago

**Status**changed from*New*to*Resolved*

Fixed the big fat bug there (that was clamping negative values to black in both log and linear scales in the colour 3d plot layer).

I also found that column normalisation was using a different normalisation method from v2.5 -- in v2.5 each column's values are distributed on the range from 0 to 1, but I had been just normalising to max 1 for v3.0. I've fixed that and gone back to the method used in v2.5.

I did actually find that the log-scale handling is wrong in some ways in v2.5. For example, if you have both log scaling and column norm, the colour scale is calculated across the whole range of log values, but then the colours are indexed from that scale using the normalised versions. This leads to various odd effects depending on how far the whole range of log values differs from the (0,1) range. Unfortunately for some cases (e.g. the MFCCs mentioned here) the plot actually looks even worse once this is fixed, but I don't think that can be helped.

See also #1797 "Should probably restrict Colour3DPlotLayer range in log mode to 80dB (or 100dB? or ...?)"

#### #3 Updated by Chris Cannam almost 3 years ago

**Status**changed from*Resolved*to*Closed*