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.Now I changed from using 'units' to 'title' and all the background rectangles remain with the same size. BUT.... 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... link for examples: https://www.dropbox.com/s/zgrjk54a8k8nmos/tdx30_Araca_NEW.png?dl=0 https://www.dropbox.com/s/mjyxgosj6ut4k56/srtm30_Araca_NEW.png?dl=0 Carlos On Wed, Jan 17, 2018 at 2:03 PM, Carlos Grohmann <[email protected]> wrote: > You mean providing the data for it? > I'm looping through 56 1x1degree DEMs, in about half of the cases the > legend gets the larger rectangle. > I used this same script before without any issues, the only difference is > that now I'm setting the range for the legend. > > 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... > > Carlos > > On Wed, Jan 17, 2018 at 10:26 AM, Anna Petrášová <[email protected]> > wrote: > >> On Wed, Jan 17, 2018 at 6:51 AM, Carlos Grohmann >> <[email protected]> wrote: >> > Hello all >> > >> > I'm producing some pngs for an article, using d.mon, d.grid and >> d.legend in >> > a python loop. In some of the images, the legend background is fine, >> but in >> > others, the background rectangle is way larger than what I defined. >> > >> > This is an example of the loop: >> > >> > >> > araca = ['tdx12_Araca', 'tdx30_Araca', 'srtm30_Araca', 'aster30_Araca', >> > 'aw3d30_avg_Araca'] >> > area_name = area[0].split('_')[-1] >> > for dem in area: >> > grass.run_command('g.region', raster=dem, flags='pa', res='0:0:01') >> > out_shade = dem + '_shade_315_20' >> > grass.run_command('d.mon', start='png', output=dem+'.png', >> resolution = >> > '2', height=600, width=600, overwrite=True) >> > grass.run_command('d.shade', shade=out_shade, color=dem) >> > grass.run_command('d.grid', size='0.25', text_color='white', >> > color='white', border_color='white', flags='c') >> > grass.run_command('d.legend', raster=dem, flags='sb', at='4,25,2,4', >> > font='Helvetica', \ >> > fontsize=12, bgcolor='240:240:240', range=(0,1500), units=' m') >> > grass.run_command('d.mon', stop='png') >> > print('PNG export OK. map: ' + dem) >> > >> > >> > This are examples of the results, note the legend background. >> > >> > >> > https://www.dropbox.com/s/skecv5lpxza7led/tdx30_Araca.png?dl=0 >> > https://www.dropbox.com/s/szbmq5kqinfbiff/aster30_wgs84_Araca.png?dl=0 >> > >> > >> > >> > I've run this same script previously without any issues. >> > >> > Any hints on why this is happening are greatly appreciated. >> >> not sure, I wonder if it's related to the fact it's latlon location. >> Would it be possible to create a reproducible example? >> >> Anna >> >> > >> > Carlos >> > >> > >> > >> > >> > -- >> > Prof. Carlos Henrique Grohmann >> > Institute of Energy and Environment - Univ. of São Paulo, Brazil >> > - Digital Terrain Analysis | GIS | Remote Sensing - >> > >> > http://carlosgrohmann.com >> > http://orcid.org/0000-0001-5073-5572 >> > ________________ >> > Can’t stop the signal. >> > >> > _______________________________________________ >> > grass-user mailing list >> > [email protected] >> > https://lists.osgeo.org/mailman/listinfo/grass-user >> > > > > -- > Prof. Carlos Henrique Grohmann > Institute of Energy and Environment - Univ. of São Paulo, Brazil > - Digital Terrain Analysis | GIS | Remote Sensing - > > http://carlosgrohmann.com > http://orcid.org/0000-0001-5073-5572 > ________________ > Can’t stop the signal. > -- Prof. Carlos Henrique Grohmann Institute of Energy and Environment - Univ. of São Paulo, Brazil - Digital Terrain Analysis | GIS | Remote Sensing - http://carlosgrohmann.com http://orcid.org/0000-0001-5073-5572 ________________ Can’t stop the signal.
_______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user
