[GRASS-user] Bar in ps.map

Moritz Lennert mlennert at club.worldonline.be
Sat Feb 23 17:26:06 PST 2013


On 24/02/13 02:11, Moritz Lennert wrote:
> On 22/02/13 15:07, Martin Album Ytre-Eide wrote:
>> Hello all.
>>
>> is it possible to bars in ps.map - like you would do in
>> v.thematic.chart ?
>
> AFAIK, the only way currently possible is to create your bar charts
> separately as eps files and to include them into your ps.map call using
> the eps parameter in the vpoints command. If you need to create
> different bar charts at different points in the map, you can give the
> eps files the cat number of points as filename and then use $ in the eps
> parameter.
>
> Attached you can see an example of such a map. I used R to create the
> bar charts automatically one for each polygon centroid, with filenames
> containing the cat numbers, and then vpoints with 'eps' and '$' in
> ps.map to create the map.
>
> I thought I had kept the scripts somewhere (but this was years ago), but
> can't seem to put my hands on them.

Found them, so here's at least parts of it (for a greytone version of 
the map):

- In R, something like this (note the onefile=FALSE with the %d format 
string for the filenames in the postscript command - AFAIR this only 
works if your cat numbers begin with 1 and have a step of one):

function() {

postscript(file="EPS/ages%d.ps",onefile=FALSE, horizontal=FALSE)
for(i in 1:length(differences[,1]))
{
    colors <- array("grey35",20)
    n=1
    for(j in differences[i,])
    {
      if(j<0) colors[n]<-"grey65"
      n=n+1
    }
    barplot(differences[i,], col=colors, horiz=TRUE, space=0, axes=F, 
names.arg=c())
}
dev.off()


}


- In ps.map:

vareas molenbeek
   fcolor none
   color 170:170:170
end
vpoints molenbeek
   type centroid
   eps /home/mlennert/ULB/DATA/ENQ2001/AGE/EPS/ages$.ps
   size 0.08
end


More information about the grass-user mailing list