<div dir="ltr">Ok, I run it again and it seems that the issue was with the size of the background rectangle, the fontsize and the units string (' m') which all ended up being larger than the predefined size.<div><br></div><div>Now I changed from using 'units' to 'title' and all the background rectangles remain with the same size.</div><div><br></div><div>BUT....</div><div><br></div><div>For some mysterious reason, in some maps the legend has the lower value (say, zero) at the bottom and the upper value (1700) at the top, and in other maps, it is inverted! Zero is on top and 1700 on the bottom...</div><div><br></div><div>link for examples:</div><div><br></div><div><a href="https://www.dropbox.com/s/zgrjk54a8k8nmos/tdx30_Araca_NEW.png?dl=0">https://www.dropbox.com/s/zgrjk54a8k8nmos/tdx30_Araca_NEW.png?dl=0</a><br></div><div><a href="https://www.dropbox.com/s/mjyxgosj6ut4k56/srtm30_Araca_NEW.png?dl=0">https://www.dropbox.com/s/mjyxgosj6ut4k56/srtm30_Araca_NEW.png?dl=0</a><br></div><div><br></div><div>Carlos</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 17, 2018 at 2:03 PM, Carlos Grohmann <span dir="ltr"><<a href="mailto:carlos.grohmann@gmail.com" target="_blank">carlos.grohmann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You mean providing the data for it? <div>I'm looping through 56 1x1degree DEMs, in about half of the cases the legend gets the larger rectangle.</div><div>I used this same script before without any issues, the only difference is that now I'm setting the range for the legend. </div><div><br></div><div>I tested it without the range parameter and it still gives the same results. I'm setting up a virtual linux machine to test it, hoping it can be something OSX-related...</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Carlos</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 17, 2018 at 10:26 AM, Anna Petrášová <span dir="ltr"><<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_5633056675142580471HOEnZb"><div class="m_5633056675142580471h5">On Wed, Jan 17, 2018 at 6:51 AM, Carlos Grohmann<br>
<<a href="mailto:carlos.grohmann@gmail.com" target="_blank">carlos.grohmann@gmail.com</a>> wrote:<br>
> Hello all<br>
><br>
> I'm producing some pngs for an article, using d.mon, d.grid and d.legend in<br>
> a python loop. In some of the images, the legend background is fine, but in<br>
> others, the background rectangle is way larger than what I defined.<br>
><br>
> This is an example of the loop:<br>
><br>
><br>
> araca = ['tdx12_Araca', 'tdx30_Araca', 'srtm30_Araca', 'aster30_Araca',<br>
> 'aw3d30_avg_Araca']<br>
> area_name = area[0].split('_')[-1]<br>
> for dem in area:<br>
>     grass.run_command('g.region', raster=dem, flags='pa', res='0:0:01')<br>
>     out_shade = dem + '_shade_315_20'<br>
>     grass.run_command('d.mon', start='png', output=dem+'.png', resolution =<br>
> '2', height=600, width=600, overwrite=True)<br>
>     grass.run_command('d.shade', shade=out_shade, color=dem)<br>
>     grass.run_command('d.grid', size='0.25', text_color='white',<br>
> color='white', border_color='white', flags='c')<br>
>     grass.run_command('d.legend', raster=dem, flags='sb', at='4,25,2,4',<br>
> font='Helvetica', \<br>
>         fontsize=12, bgcolor='240:240:240', range=(0,1500), units=' m')<br>
>     grass.run_command('d.mon', stop='png')<br>
>     print('PNG export OK. map: ' + dem)<br>
><br>
><br>
> This are examples of the results, note the legend background.<br>
><br>
><br>
> <a href="https://www.dropbox.com/s/skecv5lpxza7led/tdx30_Araca.png?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/skec<wbr>v5lpxza7led/tdx30_Araca.png?<wbr>dl=0</a><br>
> <a href="https://www.dropbox.com/s/szbmq5kqinfbiff/aster30_wgs84_Araca.png?dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/s/szbm<wbr>q5kqinfbiff/aster30_wgs84_Arac<wbr>a.png?dl=0</a><br>
><br>
><br>
><br>
> I've run this same script previously without any issues.<br>
><br>
> Any hints on why this is happening are greatly appreciated.<br>
<br>
</div></div>not sure, I wonder if it's related to the fact it's latlon location.<br>
Would it be possible to create a reproducible example?<br>
<br>
Anna<br>
<span><br>
><br>
> Carlos<br>
><br>
><br>
><br>
><br>
> --<br>
> Prof. Carlos Henrique Grohmann<br>
> Institute of Energy and Environment - Univ. of São Paulo, Brazil<br>
> - Digital Terrain Analysis | GIS | Remote Sensing -<br>
><br>
> <a href="http://carlosgrohmann.com" rel="noreferrer" target="_blank">http://carlosgrohmann.com</a><br>
> <a href="http://orcid.org/0000-0001-5073-5572" rel="noreferrer" target="_blank">http://orcid.org/0000-0001-507<wbr>3-5572</a><br>
> ________________<br>
> Can’t stop the signal.<br>
><br>
</span>> ______________________________<wbr>_________________<br>
> grass-user mailing list<br>
> <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/grass-user</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_5633056675142580471gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Prof. Carlos Henrique Grohmann<br>Institute of Energy and Environment - Univ. of São Paulo, Brazil<div>- Digital Terrain Analysis | GIS | Remote Sensing - </div><div><br></div><div><a href="http://carlosgrohmann.com/" target="_blank">http://carlosgrohmann.com</a></div><div><a href="http://orcid.org/0000-0001-5073-5572" style="font-size:13px;color:rgb(17,85,204);font-family:arial,sans-serif;background-color:rgb(255,255,255)" target="_blank">http://orcid.org/0000-0001-<wbr>5073-5572</a><br><div>________________<br>Can’t stop the signal.</div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Prof. Carlos Henrique Grohmann<br>Institute of Energy and Environment - Univ. of São Paulo, Brazil<div>- Digital Terrain Analysis | GIS | Remote Sensing - </div><div><br></div><div><a href="http://carlosgrohmann.com/" target="_blank">http://carlosgrohmann.com</a></div><div><a href="http://orcid.org/0000-0001-5073-5572" style="font-size:13px;color:rgb(17,85,204);font-family:arial,sans-serif;background-color:rgb(255,255,255)" target="_blank">http://orcid.org/0000-0001-5073-5572</a><br><div>________________<br>Can’t stop the signal.</div></div></div></div>
</div>