On Friday 30 November 2007 05:31:03 Glynn Clements wrote:
> Hamish wrote:
> > > a colleague wanted to display 3 different attributes (e.g. bare soil,
> > > vegetation, shadow), so far he did a map with a triangle plot manually
> > > (see attachment by M. Schramm).
> > >
> > > And he asked (and I wonder) if it would be possible to generate
> > > something along these lines using GRASS. Using 3 input raster and
> > > displaying a 3 gradient colour map with a corresponding triangle
> > > legend.
> >
> > scale all three maps to 0-255 (if r.rescale doesn't work for maps with
> > floating point data (it probably does, but may not), it can be done with
> > r.mapcalc).
> >
> > then use d.rgb to display it. (or perhaps d.his?)
>
> d.rgb
>
> > no ideas about how to generate the legend outside of a paint program.
>
> #!/bin/sh
> eval `g.region -g`
> r.mapcalc <<-EOF
>       tri.r = eval(\
>               s = float(col() - 1) / $cols,\
>               t = 1 - float(row() - 1) / $rows,\
>               u = s - 0.5 * t,\
>               v = t,\
>               out = u < 0 || v < 0 || u+v > 1,\
>               if(out,null(),u))
>       tri.b = if(out,null(),v)
>       tri.g = if(out,null(),1-u-v)
> EOF
> for ch in r g b ; do
>     r.colors tri.$ch color=grey1.0
> done
>
> If you want an equilateral triangle, the region needs a height/width
> ratio of cos(30) ~= 0.866.


awesome! I would vote to include it as another legend option or upload it to 
the wiki script page. 

thanks a lot - Martin

_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to