Opened 9 years ago
Closed 8 years ago
#2714 closed enhancement (fixed)
wish: logarithmic legend for raster maps
Reported by: | veroandreo | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.2.0 |
Component: | Display | Version: | svn-releasebranch72 |
Keywords: | d.legend, gsoc2016, cartography | Cc: | |
CPU: | x86-64 | Platform: | All |
Description
Hello
I have several raster maps of chlorophyll concentration (mg/m3) with mostly very small values (from 0.02 to 1.5) and few high values (between 20 and 100). When I use d.legend, as it linearly scales values from minimum to maximum, I cannot see variation in colors in those values I'm interested most, but the gradient almost only shows variation in higher values, which again, are the minority (see file attached).
Wish: A flag for logarithmic display of legend values or at least the possibility to set tick marks at desired values, i.e.: 0.01,0.1,1,10,100 (without loosing the continuos gradient, as in #1147) would be really appreciated in terms of visualization.
Hint: r.colors with logarithmic flag or transforming the raster to logarithm does not solve this issue, and one may not be interested in the logarithm of the variable, either, but just getting a good visualization of colors.
The problem is also seen in the manual of r.flow (http://grass.osgeo.org/grass71/manuals/r.flow.html#example). The third map is mostly "yellowish" but that color does not appear in the legend.
Thanks much in advance! Vero
Attachments (6)
Change History (22)
by , 9 years ago
Attachment: | example.png added |
---|
comment:5 by , 9 years ago
Keywords: | gsoc2016 cartography added |
---|
comment:6 by , 9 years ago
Milestone: | 7.0.4 → 7.0.5 |
---|
follow-up: 9 comment:7 by , 8 years ago
I added flag -l
for logarithmic legend. I hadn't any good data so please feel free to test.
comment:8 by , 8 years ago
I will test as soon as your diff is applied, but if you wanna test, here's a link to the data with which I created the first attachment:
https://dl.dropboxusercontent.com/u/59735456/chlorophyll_arg.tif
Note that the problem in this case is that most of the map has very low values, so it would be important that the legend had more "space" for those values rather than for the rest of them that are rather few.
I'm very happy that you are working on this :)
comment:9 by , 8 years ago
Replying to lazaa:
I added flag
-l
for logarithmic legend. I hadn't any good data so please feel free to test.
you can also just compute flow accumulation with
r.watershed -a elevation=elevation threshold=1000 accumulation=flowacc
I tested it by setting labels 1,10,100,1000 and there should be the same distance between them, but it's not, so there must some mistake. See an example of logarithmic legend here.
follow-up: 12 comment:10 by , 8 years ago
Also, please update your diff with changes I made to your previous diffs which are now committed. For example I changed the guisection of some new options and other things which I now see as removed in your diffs.
by , 8 years ago
Attachment: | chloro.png added |
---|
follow-up: 13 comment:11 by , 8 years ago
Thanks for real data, it was much easier find the mistake. It gives better results now. At least on todo left. Digits after decimal point are displayed only when small value min-max range is used. I don't think that's disared option in case of logarithmic scale. I add a condition so now when logarithmic scale is used three digits after decimal point are displayed but maybe I should add new option so user can determine how many digits display?
comment:12 by , 8 years ago
Replying to annakrat:
Also, please update your diff with changes I made to your previous diffs which are now committed. For example I changed the guisection of some new options and other things which I now see as removed in your diffs.
I updated my diff, but I wasn't sure if there's any svn method I could use without losing my code for that so I did it manually.
follow-up: 14 comment:13 by , 8 years ago
Replying to lazaa:
Thanks for real data, it was much easier find the mistake. It gives better results now.
Yes, it is better indeed. But check how the scale for chlorophyll proposed by NASA looks like (and how a logarithmic scale looks like in general): http://oceancolor.gsfc.nasa.gov/images/CHL_chlor_a_colorscale.png
Values should be equally spaced, "graphically" speaking (for example: 0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0) and therefore more space in the color palette is needed for lower values, i.e.: more space for "blues" "cyans" and "greens" in your example (there's still a lot of red).
...
but maybe I should add new option so user can determine how many digits display?
This could be useful in general :)
by , 8 years ago
Attachment: | chloro2.png added |
---|
follow-up: 15 comment:14 by , 8 years ago
Replying to veroandreo:
Replying to lazaa:
Thanks for real data, it was much easier find the mistake. It gives better results now.
Yes, it is better indeed. But check how the scale for chlorophyll proposed by NASA looks like (and how a logarithmic scale looks like in general): http://oceancolor.gsfc.nasa.gov/images/CHL_chlor_a_colorscale.png
Values should be equally spaced, "graphically" speaking (for example: 0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0) and therefore more space in the color palette is needed for lower values, i.e.: more space for "blues" "cyans" and "greens" in your example (there's still a lot of red).
You're right, I used wrong formula to calculate the scale.
...
but maybe I should add new option so user can determine how many digits display?
This could be useful in general :)
comment:15 by , 8 years ago
Replying to lazaa:
Replying to veroandreo:
Replying to lazaa:
Thanks for real data, it was much easier find the mistake. It gives better results now.
Yes, it is better indeed. But check how the scale for chlorophyll proposed by NASA looks like (and how a logarithmic scale looks like in general): http://oceancolor.gsfc.nasa.gov/images/CHL_chlor_a_colorscale.png
Values should be equally spaced, "graphically" speaking (for example: 0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0) and therefore more space in the color palette is needed for lower values, i.e.: more space for "blues" "cyans" and "greens" in your example (there's still a lot of red).
You're right, I used wrong formula to calculate the scale.
Looks much much better now! Thanks! :)
comment:16 by , 8 years ago
Milestone: | 7.0.5 → 7.2.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Version: | svn-releasebranch70 → svn-releasebranch72 |
example lacking logarithmic representation