[GRASSLIST:384] Re: Legends

Glynn Clements glynn.clements at virgin.net
Sat Jun 14 13:34:06 EDT 2003


H Bowman wrote:

> > * Now, the opposite problem:
> >  Is there a way to force GRASS to display a legend based on a given
> >  color table, even if some categories are missing ?
> > For example, I have a FCELL map with values in the range 0-1000. The
> > legend starts at the lowest category (say, 127) and ends at the
> > largest (say, 851), when in fact, I expect a display from 0 to 1000.
> > Here again, any work around ? (apart forcing one of the cells to 0,
> > and another to 1000 ?) Could it be implemented for a next version ?
> 
> d.legend takes the color from the map. If the color doesn't exist in the
> map, d.legend can't know what to use. I think it is a bad idea to have
> d.legend try and extrapolate a color value or read directly from the
> colr file and re-implement existing library functions. I suppose it
> might be feasible to extend the default range with the range= option
> with whatever library function the raster map uses to find its color
> value if you wanted, but I have no plans to do so and don't think the
> official version should do this either.

Note that there is a public mechanism for obtaining the extent of the
colour table, i.e. G_get_d_color_range().

However, I'm not sure whether that is actually the right approach. 
It's arguable that there should be some notion of the "total" range,
distinct from the range of values which actually occur.

E.g. for intensity rasters (i.e. images), it would be useful to be
able to determine that e.g. 255 corresponds to "100%".

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list