[GRASSLIST:6334] Re: create a legend
hamish_nospam at yahoo.com
Mon Apr 4 19:39:27 EDT 2005
> I'm trying to modify a legend en grass 6.0, I mean, I got a legend
> with colors and values, but I want to write names instead of values.
> How can I do?
Yes, d.legend and ps.map's legend support this (actutally ps.map pretty
much relies on categories being named for a legend).
Usually you would use r.support to add category labels to a raster ...
but this module is not in the 6.0.0 release. It has been ported by Brad
Douglas though so hopefully will be in CVS soon and appear in the next
So you are left with having to edit the category file by hand. It is
located in $MAPSET/cats/MAP_NAME and looks like this:
[this one was created by r.buffer]
# 2 categories
0.00 0.00 0.00 0.00
1:distances calculated from these locations
The general idea is you list category number ":" text label after the
first four lines of the file.
I believe this partially works for floating point maps, but as values
are not exact I wouldn't rely on it (hint: try the use= option).
Once you have a good cats/ file (test with d.what.rast), make a
text-only legend with 'd.legend -c'. Set the font with d.font.freetype
if you want it really pretty.
> I tried with d.rast.edit but it doesn't work. it says me this:
I don't know why that happens, it works for me.
More information about the grass-user