Hello,
I'm using MyBlockRenderer and XYPlot to make contour plots. The problem I have is that the values of the data are not uniformly distributed. For example, I may have less than 5% of extreme values that are way larger or smaller than the others. Consequently, when I use the PaintScaleLegend to draw the colorbar, the colorbar is filled with the values that rarely seen in the contour plot. So, I'd like to know if there is a way to make a nonlinear colorbar.
Thanks in advance,
Jane
non-linear colorbar
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: non-linear colorbar
Have you tried to set a LogAxis as ValueAxis for the PaintScaleLegend?
Re: non-linear colorbar
No. That's because I have both positive and negative values. About 5% of values are between -155 and -20, 3% between +20 and +25, and the rest are in between -20 and +20.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: non-linear colorbar
what type of PaintScale are you using? For your case, a LookupPaintScale could be a good idea. You could also create your own implementation from scratch.
Re: non-linear colorbar
Hello Paradoxoff,
First of all, thank you very much for your interest.
Yes, I did use the LookupPaintScale. I set most of the colors to the range within +-20. The range outside was assigned to only a few colors.
The plot looks ok, but the ticks on the colorbar are evenly spaced out. Therefore, large portion of the colorbar is devoted to the small fraction
of the data points. Did I explain clear enough? I wish I know how to put my plot here so that you know exactly what I mean.
Do you have any suggestions regarding to the colorbar? Here is part of the code I used to make it:
LookupPaintScale scale = new LookupPaintScale(imin, imax, Color.white);
scale.add( contourValue1, new Color( r[0], g[0], b[0] );
scale.add..............
.........................
NumberAxis scaleAxis = new NumberAxis("My color scale");
PaintScaleLegend legend = new PaintScaleLegend(scale, scaleAxis);
...............................
..............................
chart.addSubtitle(legend);
First of all, thank you very much for your interest.
Yes, I did use the LookupPaintScale. I set most of the colors to the range within +-20. The range outside was assigned to only a few colors.
The plot looks ok, but the ticks on the colorbar are evenly spaced out. Therefore, large portion of the colorbar is devoted to the small fraction
of the data points. Did I explain clear enough? I wish I know how to put my plot here so that you know exactly what I mean.
Do you have any suggestions regarding to the colorbar? Here is part of the code I used to make it:
LookupPaintScale scale = new LookupPaintScale(imin, imax, Color.white);
scale.add( contourValue1, new Color( r[0], g[0], b[0] );
scale.add..............
.........................
NumberAxis scaleAxis = new NumberAxis("My color scale");
PaintScaleLegend legend = new PaintScaleLegend(scale, scaleAxis);
...............................
..............................
chart.addSubtitle(legend);
Re: non-linear colorbar
Perhaps, one way to do this is
1. Re-assign values to my dataset
For example, set anything less than -20 to 1; set values between -5 and -3 to 2; .....
2. Make the contour plot
3. Make the colorbar with PaintScaleLegend();
4. Somehow erase the tickmark labels for the colorbar
5. Label the tickmarks with the original values for the contours (ie. -20, -5, -3 etc.)
Any other suggestions:?:
1. Re-assign values to my dataset
For example, set anything less than -20 to 1; set values between -5 and -3 to 2; .....
2. Make the contour plot
3. Make the colorbar with PaintScaleLegend();
4. Somehow erase the tickmark labels for the colorbar
5. Label the tickmarks with the original values for the contours (ie. -20, -5, -3 etc.)
Any other suggestions:?: