[GRASS-user] displaying many thematic maps from one vector dataset

Moritz Lennert mlennert at club.worldonline.be
Wed Apr 8 13:24:39 EDT 2009


On 08/04/09 18:48, Vishal Mehta wrote:
> Hi Moritz,
> Regarding legends with d.graph, these are the main issues where I found 
> I needed to do too much of trial and error, some of which I think could 
> probably be avoided/improved in a future version...
> 
> 1. the legend ends up with some strange additions beyond just the range 
> of data: like what are those numbers after each range
> e.g. in the example below where did | 0 and | 5 come from? It would be 
> nice to not have this automatically displayed.
> 60 - 80 | 0
> 80-100 | 5

This comes from my scientific background which says that a legend should 
include information about the frequencies of observations in each class. 
This is what these numbers show. But I agree that this should probably 
be optional.

> 
> 2. there could be a flag on d.graph, which allows the output to have a 
> "< minbreak" and "> maxbreak" option, so that for cases like the one we 
> are discussing, the legend does not keep changing based on different 
> data ranges.

d.graph is "just" a drawing module. Any such flags will have to go into 
d.thematic.area, or a specific d.thematic.legend module, but yes, sounds 
good.

> 
> 3. size and position
> Here, I wanted to get a legend file separately, and save a legend png. 
> To do this I had to play with the size and other parameters extensively 
> to make the symbols and associated text match up. It would be great to 
> be able to do the following with some flags, for the case where the 
> legend alone is displayed:
> (i) set the overall size of the display within which the legend will be 
> displayed
> (ii) set the position of the legend within the display with options like 
> lowerleft, upperright, center, etc

positioning in d.graph is in percentage, so the size of the display 
should not make a difference for the relative localisation.

> (iii) set the size of the legend as a fraction/percentage of the display.

Size of text is in percentage, but size of symbols aren't. But I guess 
you mean the legend as a whole. There should probably be some way to 
calculate the size of the different elements given a general value from 
the user. Again, this would have to be a parameter for d.thematic.*.

> (iv) make the background transparent (or not)

At this stage the background is transparent, but I could add a flag to 
allow non-transparent (you can do it yourself by just drawing a white 
rectangle underneath).

> such that the above settings 'automatically' set up the symbol and 
> corresponding text all properly lined up..

d.graph does not have any "alignment" feature, you have to work with the 
percentage positioning, but one problem (I think) is that different 
fonts have different sizes, so a same size but different font will lead 
to different alignments.

> 
> I am aware that if I was just better at this I could do it quickly 
> enough..but the above functionality would make it easier for 
> less-than-expert people like myself, who try to use open-source as much 
> as possible despite the handicap of having been groomed on Windows...

Cartography is currently one of the weak points of GRASS, although you 
can't beat it for automatic cartography as you are doing (well, gmt can 
do that, but don't know about thematic cartography in gmt).

Thank you for the extensive feedback, though. I get the feeling that 
there should be some d.thematic.legend module which uses the output of 
the -l flag of d.thematic.area to then create a nice-looking legend.

You might also want to have a look at ps.map which allows some more 
sophisticated cartography and offers an automatic legend.

Moritz


More information about the grass-user mailing list