[GRASS-SVN] r67342 - grass-addons/grass7/raster/r.out.legend
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 23 08:25:51 PST 2015
Author: pvanbosgeo
Date: 2015-12-23 08:25:51 -0800 (Wed, 23 Dec 2015)
New Revision: 67342
Modified:
grass-addons/grass7/raster/r.out.legend/r.out.legend.html
grass-addons/grass7/raster/r.out.legend/r.out.legend.py
Log:
Some fine-tuning
Modified: grass-addons/grass7/raster/r.out.legend/r.out.legend.html
===================================================================
--- grass-addons/grass7/raster/r.out.legend/r.out.legend.html 2015-12-23 16:15:51 UTC (rev 67341)
+++ grass-addons/grass7/raster/r.out.legend/r.out.legend.html 2015-12-23 16:25:51 UTC (rev 67342)
@@ -34,6 +34,15 @@
<a href="https://grass.osgeo.org/grass70/manuals/ps.map.html">ps.map</a>.
<p>
+With file type set to 'png', the png driver is used to create
+the image. An alternative way to create a png image file is to set
+as file type 'cairo' and provide an output file name with as
+extension '.png'. This will use the cairo driver to generate the png
+image. One advantage of the cairo driver is that it uses
+anti-aliasing, which might give nicer results (smoother lines and
+numbers). Compare the output for example 1 and 4.
+
+<p>
The user may create a horizontal legend by making the box wider
than it is tall. Note that for vertical legends labels are placed to
the right of the legend box. For horizontal legends the text will
@@ -121,6 +130,19 @@
<p><img src="r_out_legend_3.png">
+<h3>Example 4</h3>
+
+Like example 1, but using the cairo driver to create the png image.
+The difference is that the cairo driver uses anti-aliasing.
+
+<div class="code"><pre>
+r.out.legend raster=elevation file=r_out_legend_4.png filetype=cairo \
+ dimensions=4,0.4 labelnum=3 fontsize=7 unit="cm" resolution=150
+</pre></div
+
+<p><img src="r_out_legend_4.png">
+
+
<h2>SEE ALSO</h2>
<em><a href="d.mon.html">d.mon</a></em>,
Modified: grass-addons/grass7/raster/r.out.legend/r.out.legend.py
===================================================================
--- grass-addons/grass7/raster/r.out.legend/r.out.legend.py 2015-12-23 16:15:51 UTC (rev 67341)
+++ grass-addons/grass7/raster/r.out.legend/r.out.legend.py 2015-12-23 16:25:51 UTC (rev 67342)
@@ -216,7 +216,7 @@
iw = w
ih = h
fz = 1
- at = "1,99,1,99"
+ at = "1,99,2,98"
else:
fz = round(float(fontsize) * (float(resol)/72.272))
@@ -231,14 +231,14 @@
if float(height)>float(width):
iw = w + fz * maxl
ih = h
- at = "1,99,1," + str((100*w/iw)-1)
+ at = "1,99,3," + str((100*w/iw)-1)
else:
minval = round(maprange['min'],digits)
margin_left = 0.5 * (len(str(minval)) - 1)
margin_right = 0.5 * maxl
iw = w + fz * (margin_left + margin_right)
ih = h + fz * 1.5
- at = str(100 - (100*h/ih)) + ",99," + \
+ at = str(100 - (100*h/ih)) + ",96," + \
str((100 * fz * margin_left / iw)) + "," + \
str(100 - (100 * fz * margin_right / iw))
@@ -260,7 +260,7 @@
grass.run_command("d.legend", flags=flag, raster=inmap, font=font,
at=at, fontsize=fz, labelnum=labelnum, range=val_range)
- grass.run_command("d.mon", stop=filetype)
+ grass.run_command("d.mon", flags="r", stop=filetype)
grass.info("----------------------------\n")
grass.info("File saved as " + outputfile)
grass.info("The image dimensions are:\n")
More information about the grass-commit
mailing list