visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
438 stars 116 forks source link

Symlog scaling #18827

Open ykempf opened 1 year ago

ykempf commented 1 year ago

It would be very useful if alongside the Linear, Log and Skew one could set symmetric log scales for plots like pseudocolor. The use case is for variables spanning exponential ranges both in the negative and positive domain, which can be plotted on a diverging colorscale with log scaling applied to the positive and negative parts, and linear scaling across a small interval straddling zero, either set by a value or a percentage of the min/max. It can be constructed with thresholds and separate plots for the positive and negative portions separately, but an automatic feature would be awesome.

markcmiller86 commented 1 year ago

Some notes

markcmiller86 commented 1 year ago

In our discussion today, we talked about a couple of different ways log scaling may come into play. One is in the coordinate axes. And, I just noticed in Visit that we support this in View controls on curves and 2D plots but not 3D plots. That seems a bit odd to me. It might be rare that users deal with 3D geometry in which one of the geometric dimensions is orders of magnitude larger than another but I do occasionally see long, skinny 3D stuff and we do occasionally encounter data we have difficulty handling because its really, really big, or really, really small. Being able to log scale the coordinates in 3D views kinda sorta makes sense to me.

Of course, log scaling coordinates is the issue @ykempf was suggesting symlog as a better approach for.

The other place we discussed it is in the color mapping. Do we use the linear variable scale to index the color map or a log variable scale to index it. In that case, our index is always positive and there is always an implied shift of the variables range to do that though I don't know how close to zero is handled in that case either.

So, now I wonder if the symlog approach has ever been applied to color map indexing itself.

Next, I am thinking about the coordinate manipulation we offer in the Transform Operator. There, we offer things like spherical to cartesian. We don't offer log scaling there. Why do we associate log scaling of coordinates in image space (e.g. with the View) instead of object space (e.g. the Transform Operator)?

ykempf commented 1 year ago

SymLog is also available for color scales in matplotlib btw. https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm