[GRASSLIST:8767] Re: Querying display monitor locations as percent from origin (0,0)?

Hamish hamish_nospam at yahoo.com
Wed Oct 26 20:49:34 EDT 2005

> I'm trying to create a simple legend for sediment grainsize analyses
> (attributes consist of % gravel, % sand, % silt, % clay). I already
> have some really nice looking pie charts created using d.vect.chart,
> and now I want an accompanying legend in the upper-right corner of the
> monitor for a screen capture. Is there a way to query the coordinates
> of locations on the monitor as percentages from the lower-left corner?
> I could make a reasonable guess as to where I think the legend should
> appear in display coordinates, but I want to use d.graph to build a
> little window containing all the legend elements; having the exact
> queried coordinates could just be pasted into the d.graph command. 

I think the best you can do is kruler and a hand calculator.. :/

> Alternatively......
> Is there a better way to create vector legends for d.vect.chart? I
> couldn't find anything in the manual that seemed to cover it.

The way I would do it:
Make a dummy raster map with a number of categories corresponding to
your color values. Set the colors correctly with `r.colors rules=` and
set the category names with r.support*, then display just the legend
with `d.legend -c`. Maybe v.to.rast would get you started.

[*] Not in 6.0 (in 5.4- and 6.1+), if you are using 6.0 you can just 
edit the $MAPSET/cats/$MAPNAME file. Use a map made by r.buffer as a
template for the cats file in this case.

> Alternatively......

same idea, but use d.vect.thematic (6.1 only).


More information about the grass-user mailing list