2d plot log ranges - advanced
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The following explains an advanced implementation for log Y axis, 2d plots. It is the same algorithm that is needed for log color map. See bug 14895 for a use case.
Here is an e-mail thread created about modifications to the min and max color ranges for log scaling. This should be implemented in 4.3.
I would like to propose a few changes in our log scaling algorithm for painting a dataset by a variable. I discussed this with Utkarsh, and he asked that I bounce it off the e-mail list. So, here goes.
Currently, when a user log scales a variable, if all data is positive, ParaView just uses the normal min and max. There are times when this is not proper – for instance when looking at the temperature or density of material in a supernova, or velocity of outbound gas. Another example is large data, with noise around zero. I would like to propose that we have a user selectable option to set the minimum at maximum10^-q, where q is user defined but defaults to 4. In other words, the minimum would be set to 110^-4 of what the maximum is.
If all of the user’s data is negative, ParaView grumbles, and then seg faults using a current master git pull – not optimal behavior. In PV 4.1, it just sets min and max to 0. I would like to propose that ParaView calculate the log of the data, as follows: Index= -(log(abs(Var))). Then, just draw the color legend as normal – for instance, red at top, white in the middle and blue at bottom. Tick marks will be the reverse of positive log scaling – with the dense numbers, more negative numbers at the bottom and less dense, less negative numbers at the top.
The problem arises with data that spans positive and negative numbers. Since the log of 0 is infinity, we have to deal with very small numbers in a special way. I propose that we find maxVal = max(maximum, abs(minimum)). Then, we set the color bar to run from maxVal to –maxVal. We log scale the top half of the color legend, running from maxVal to maxVal10^-4, and we reverse log scale the bottom half of the color legend, running from –maxVal10^-4 to –maxVal. We calculate this negative range the same as the all negative data section above. All data between maxVal10^-4 and -maxVal10^-4 would remain white by default, or user selectable black.
User selectable functionality would be as follows: • to allow/ not allow negative numbers (default allow) • to be able to change the q exponent (i.e., 4 above) (default 4) • to be able to change the painting color that is too small (default white) • to clamp minimum to some number (such as q == 4 above). (default on).
Reply to a question on negative numbers:
Regarding negative values, my bad - I was not clear. A vertical normal log scale bar, going from a 1e8 to 1e4 may have minor labels (working down) of 1e8, 1e7, 1e6, 1e5, and 1e4. I.e., each tick towards the top representing a change of 10 million units, each tick towards the top representing a change of a thousand units. Now, for the negative case, this would be reversed. The color bar remains colored as before (for default color map, red on top, blue on bottom). Since more positive numbers are always on top, we would run as follows (working down the minor labels): -1e4, -1e5, -1e6, -1e7 and -1e8. Units change by the thousands at the top of the color legend, and millions towards the bottom.