I found myself using GIMP to place legends on raster images quite often, which didn't seem quite right, so I went ahead and wrote in the functionality that I wanted. And then I kept going..
New d.legend features include:
+ Legend text for floating point rasters is now much prettier.
(%f -> %.2f, etc). Really tiny FP values convert to "2.4e-7" format.
+ at=x1,y1,x2,y2 implemented. Module is now scriptable / survives d.redraw
+ reimplemented -n flag: skip categories without labels. lines= takes on a new
meaning when using this flag; means "up to category #". Its meaning becomes
more blurry when you use lines=, thin=, and the -n flag together. This is
a feature.
+ Floating point rasters now have the highest values at the top,
lowest at the bottom.
+ Auto-scales text to fit in display window if bounds not manually set with
at= or with mouse. Always auto-scales the "4 of 16 categories" text if
needed.
+ You can now select the legend box with the mouse from any two corners
and it will still work.
+ If you select a lower corner before a higher corner, the legend will
reverse vertically. This also happens if the y values in at= are reversed.
Works for horizontal legends as well.
+ fixed color-box off center within white frame for integer cats.
+ uses full legend box height to draw, even when using thin= or lines=.
+ better determines when to force a smoothed legend when using -n, lines=,
&/or thin=.
+ smoothed legends with <5 categories now show <5 text labels.
+ Misc. code clean up & bug fixes, cleaned out some duplicate and
unused code.
So, please try the new d.legend now in CVS, and let me know how badly you can break it, or what fine tuning you think it needs.
Hamish
p.s. - I've included a PNG of a legend I made with the PNG driver- it isn't quite right. Any ideas on if this would be a d.legend bug or a PNG driver bug? Both monitors were set to the same width and height (+/- 1 pixel). Does PNG size need to match res from g.region for non-lossy output??