And one more for the wish list on legends: - a flag to strip off decimal places if the data happens to be float..
On Wed, Apr 8, 2009 at 9:48 AM, Vishal Mehta <[email protected]> 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 > > 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. > > 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 > (iii) set the size of the legend as a fraction/percentage of the display. > (iv) make the background transparent (or not) > such that the above settings 'automatically' set up the symbol and > corresponding text all properly lined up.. > > 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... > > I will write back when i've had a chance to look up the segfaults on my > laptop.. > > And oh, the mismatch of color between display and legend was entirely my > fault - i was displaying with one set of colors but had tweaked the legend > file separately with a different set of colors.. > > Thanks for all your help, > Vishal > > > On Wed, Apr 8, 2009 at 4:58 AM, Moritz Lennert < > [email protected]> wrote: > >> On 08/04/09 02:23, Vishal Mehta wrote: >> >>> Regarding the segmentation faults: I switched to a different machine >>> to do all this latter work. I havent tried the new scripts on the >>> original machine (my laptop). Both are running 6.4svn. >>> >> >> Weird. I can confirm segfaults in 6.5svn (I suppose that this is what >> you mean by 6.4svn, i.e. the current 6.x development branch), but only >> when using d.mon, not when using direct rendering >> (GRASS_RENDER_IMMEDIATE=TRUE). Since I wrote this code on the base of >> the grass7 tree, and then ported it back to 6.x, it is quite probable >> that I forgot some adaptations needed for d.mons... (CC'ing to Glynn for >> any pointer on where I should look). >> Could you try with direct rendering on the machine where it segfaulted >> with d.mons ? >> >> Regarding legends, I found that I had to play around way too much to >>> get the legend right. >>> >> >> Could you tell me which were the major parts that needed adjustment from >> you ? >> >> As you want to use the same legend for all maps, it is obviously easier >> to create one legend file by hand and to call d.graph on that in each >> cycle of the loop. >> >> However, I tweaked the source code (grass7 for now) just very slightly >> (changing text size and taking into account the case where the min value of >> the data is above the lowest break (or the max value below the highest break >> - see 2010-2030 max values in the example) and then ran the following script >> (using direct rendering as monitors don't exist anymore): >> >> export GRASS_FONT=Vera >> export GRASS_PNG_READ=TRUE >> >> yr=2010 >> while [ $yr -lt 2105 ] ; >> do >> echo "yr is $yr " >> export GRASS_PNGFILE=pc$yr.png >> d.thematic.area map=CA column=pc$yr breaks=20,40,60\ >> colors=cyan,yellow,red,blue leg=legfile >> d.text -b text="$yr Population" at=50,90 size=4 >> d.graph in=legfile >> if [ $yr -eq 2090 ] >> then yr=$((yr+10)) >> else yr=$((yr+5)) >> fi >> done >> >> >> You can see the resulting animated gif here: >> http://geog-pc40.ulb.ac.be/popCA.gif >> >> I don't find the legends too bad, but obviously it is difficult to create >> a one-size-fits-all solution for legends. I spent some time trying to find >> the right algorithm, but it is still very far from perfect. One thing I >> should probably add is a parameter for the placement of the legend in screen >> percents. Another is a detection mechanism to see how many significant >> decimals to keep (There should be some examples, notably in Hamish'es work, >> I just need to look at those...). I don't know, however, whether the d.graph >> solution is the best, so feedback is very welcome on that. >> >> >> And even then, there's a yellow color that is not on the legend file, >>> that shows up in the display anyway. >>> >> >> Could you show an example of that ? >> >> Thank you for your feedback so far. We really have to identify the cause >> of those segfaults... >> >> Moritz >> > > > > -- > Vishal K. Mehta, PhD > Scientist > Stockholm Environment Institute - US > 133 D St Suite F > Davis CA 95616 > www.sei-us.org > -- Vishal K. Mehta, PhD Scientist Stockholm Environment Institute - US 133 D St Suite F Davis CA 95616 www.sei-us.org
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
