[GRASS-user] Bar in ps.map

Hello all.

is it possible to bars in ps.map - like you would do in v.thematic.chart ?

Martin

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.

Moritz

(attachments)

GRASS_map_with_bar_charts.pdf (42.2 KB)

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

Moritz:

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.

probably a nice tip/example to put in the ps.map wiki pages?

by the way/for the record, for the display monitors d.vect.chart
can do both the bar charts and bubble plots, but now d.vect
can do bubble charts too.

the ps.map vpoints sizecolumn instruction allows you to make
bubble plots there (I'm not sure if your example used that or
not). The vpoints rotatecolumn can also be useful for point
symbols, and color from rgbcolumn. I'm pretty sure I haven't
coded in the primary/secondary color scheme for symbols that
d.vect uses yet, which will improve the rgbcolumn support
automagically.

Hamish