[GRASS-dev] [GRASS GIS] #124: d.legend: apply arbitrary labels to a smooth floating-point colorbar

#124: d.legend: apply arbitrary labels to a smooth floating-point colorbar
--------------------------------+-------------------------------------------
Reporter: epatton | Owner: grass-dev@lists.osgeo.org
     Type: enhancement | Status: new
Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Keywords: colorbar, d.legend |
--------------------------------+-------------------------------------------
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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/124&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#124: d.legend: apply arbitrary labels to a smooth floating-point colorbar
--------------------------+-------------------------------------------------
  Reporter: epatton | Owner: hamish
      Type: enhancement | Status: assigned
  Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: | Keywords: colorbar, d.legend
--------------------------+-------------------------------------------------
Changes (by hamish):

  * status: new => assigned
  * owner: grass-dev@lists.osgeo.org => hamish
* cc: grass-dev@lists.osgeo.org (added)

Comment:

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/124#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#124: d.legend: apply arbitrary labels to a smooth floating-point colorbar
--------------------------+-------------------------------------------------
  Reporter: epatton | Owner: hamish
      Type: enhancement | Status: assigned
  Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: | Keywords: colorbar, d.legend
--------------------------+-------------------------------------------------
Comment (by epatton):

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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/124#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#124: d.legend: apply arbitrary labels to a smooth floating-point colorbar
--------------------------+-------------------------------------------------
  Reporter: epatton | Owner: hamish
      Type: enhancement | Status: assigned
  Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: | Keywords: colorbar, d.legend
--------------------------+-------------------------------------------------
Comment (by hamish):

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/124#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#124: d.legend: apply arbitrary labels to a smooth floating-point colorbar
--------------------------+-------------------------------------------------
  Reporter: epatton | Owner: hamish
      Type: enhancement | Status: closed
  Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: worksforme | Keywords: colorbar, d.legend
--------------------------+-------------------------------------------------
Changes (by epatton):

  * status: assigned => closed
  * resolution: => worksforme

Comment:

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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/124#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/