[GRASS5] GRASS 5.3: d.legend font size problem

Hamish hamish_nospam at yahoo.com
Wed Mar 24 20:16:25 EST 2004

> >> I have a problem with the automatic adjustment of font size in
> >> d.legend. Using frames, I created the following display:
> >> http://moritz.homelinux.org/misc/good_legend.png
> >> where everything displays fine. But when I try to reduce the width
> >> of the frame containing the raster legend, I get the following result:
> >> http://moritz.homelinux.org/misc/bad_legend.png
> >> In an (old) thread
> >> (http://thread.gmane.org/gmane.comp.gis.grass.devel/154) Hamish said
> >> "the maxfontsize= functionality is somewhat unneeded now that font
> >> size will auto-adjust if it is too large for the window", but this
> >> does not seem to work in my case...
> >> Any hints ?
> >
> > Auto-scaling text is only implemented for categorical legends.
> > I'll look into getting it working for gradient legends too.

Ok, I just added support for FP (gradient) legends, please test.

I know it will give odd looking output if you auto-scale when using the
flip flag, the solution means adding a pre-formatting loop to know in
advance what the longest text string will be. That's more work than I
want to do right now for a corner case. Maybe if some is desperate I'll
revisit it.

> > Another option is to use the use= option. ;) This will make a
> > category legend & thus auto-scale the text. From the look of your
> > map, this may be suited to your data..
> Even though it might not seem so, there are 589 categories in this
> map, so the use option is not very practical. (Actually this map is
> complete nonsense, I'm just using it for a proof of concept)

Ok, you might try the "-n" flag to only draw categories with labels
then or play with the "thin=" & "range=" options.

> > BTW, have you tried the new horizontal legends? Maybe that is more
> > appropriate for your map?
> How do I create those, I didn't find it obvious to grasp that from the
> man page ?

"When using the mouse or at= to size & place the legend, a user may
create a horizontal legend by making the box wider than it is tall."


More information about the grass-dev mailing list