Opened 16 years ago

Closed 16 years ago

#124 closed enhancement (worksforme)

d.legend: apply arbitrary labels to a smooth floating-point colorbar

Reported by: epatton Owned by: hamish
Priority: minor Milestone: 6.4.0
Component: Default Version: svn-trunk
Keywords: colorbar, d.legend Cc: grass-dev@…
CPU: Unspecified Platform: Unspecified

Description

In d.legend, one is able to request arbitrary cat values for labelling with the use= parameter, but doing so creates blocks around each cat value requested in the output color bar. I would like to request the ability to arbitrarily label values on a *smoothed* color bar for a floating-point raster. d.legend makes nice color bars for floating point elevation/bathymetry rasters, I would just like it to label whatever set of values I give it, while maintaining the nice, smooth color bar over the entire range of raster values.

~ Eric.

Attachments (2)

legend1.png (8.2 KB ) - added by epatton 16 years ago.
Legend showing smooth, continous color bar for floating-point raster.
legend2.png (10.9 KB ) - added by epatton 16 years ago.
Legend 2 allows user-defined labels, but chops legend into blocks

Download all attachments as: .zip

Change History (6)

comment:1 by hamish, 16 years ago

Cc: grass-dev@… added
Owner: changed from grass-dev@… to hamish
Status: newassigned

A few other buggy things to note,

use=0.0,0.2,0.4,0.6,0.8,1.0 only keeps the int part.

IIRC use= for FP with a categorty label used to display the label but doesn't anymore (may be bad memory, need to go back and test with GRASS 5)

Eric, may I ask for an example? Lock a tick-label at 0? Log scale? Should we allow numbers to overlap?

Hamish

by epatton, 16 years ago

Attachment: legend1.png added

Legend showing smooth, continous color bar for floating-point raster.

by epatton, 16 years ago

Attachment: legend2.png added

Legend 2 allows user-defined labels, but chops legend into blocks

comment:2 by epatton, 16 years ago

Ok, for instance, see legend1.png; it shows a color bar divided into 6 intervals on a floating-point bathymetry dataset; I don't want to use odd depth values like -188 and -92; I would prefer to label -200, -150, -100, etc. When I use the use= paramter, the legend gets chopped into squares, ruining the nice, continous color bar (legend2.png; also, the labels become huge for some reason).

So basically, I would ideally like a color bar like legend1.png, but with arbitrary labels applied.

comment:3 by hamish, 16 years ago

Using the range= and labelnum= options you should be able to get the look you are after.

d.legend range=0,-200

then you get labelnum=5 ticks at: 0,-50,-100,-150,-200

  • adjust your color rules so that they cover the full range
  • with the range= option do max,min instead of min,max to flip the legend vertically (or use the -f flag)

see also ps.map's colorbar legends. They work the other way and try to fall on round numbers automatically. Both ways have their merits, but I guess I hear less complaints about the ps.map way. (but less people use that, so who knows)

Hamish

comment:4 by epatton, 16 years ago

Resolution: worksforme
Status: assignedclosed

Ok, great! This is what I was looking for. Sorry for the noise; I misinterpreted what labelnum= was used for, and so never tried it in combination with range=. For most cases I should be able to play with labelnum to get the right divisor into the raster range.

Thanks; closing request,

~ Eric.

Note: See TracTickets for help on using tickets.