Hi,
I want to generate a map legend with number in scientific format. (I have number like 1.0E+14 and in the legend appear like 100000000000000)…
Thanks,
Salvatore
Hi,
I want to generate a map legend with number in scientific format. (I have number like 1.0E+14 and in the legend appear like 100000000000000)…
Thanks,
Salvatore
On Mon, Nov 14, 2011 at 4:42 PM, Salvatore Mellino
<salvatore.mellino@gmail.com> wrote:
Hi,
I want to generate a map legend with number in scientific format. (I have number like 1.0E+14 and in the legend appear like 100000000000000)…
Do you use d.legend?
http://grass.osgeo.org/grass64/manuals/html64_user/d.legend.html
"The text produced from floating-point raster maps will automatically create
output with a meaningful number of significant digits. For very small values,
numbers will be expressed in scientific notation, e.g. "1.7e-9".
"
Perhaps that should be likewise implemented for very large numbers, too?
Markus
Salvatore:
> I want to generate a map legend with number in
> scientific format. (I have number like 1.0E+14
and in the legend appear like 100000000000000)…
MarkusN:
Do you use d.legend?
http://grass.osgeo.org/grass64/manuals/html64_user/d.legend.html
"The text produced from floating-point raster maps will
automatically create
output with a meaningful number of significant digits. For
very small values,
numbers will be expressed in scientific notation, e.g.
"1.7e-9".
"Perhaps that should be likewise implemented for
very large numbers, too?
It is based on the data's range.
for the morbidly curious,
/* determine how many significant digits to display based on range */
if (0 == (dmax - dmin)) /* trap divide by 0 for single value rasters */
sprintf(DispFormat, "%%f");
else {
SigDigits = (int)ceil(log10(fabs(25 / (dmax - dmin))));
if (SigDigits < 0)
SigDigits = 0;
if (SigDigits < 7)
sprintf(DispFormat, "%%.%df", SigDigits);
else
sprintf(DispFormat, "%%.2g"); /* eg 4.2e-9 */
}
The idea being that if the legend range is 1e6 to
-1e6 it just clutters the page to show so many
digits.
At the time I wrote that code I was using r.sun a
lot, so I'll go back and see what the old annual
solar irradiation plots were looking like, as those
numbers get pretty big too.
What threshold to use for the switchover to sci/eng
format? >=10million?
Hamish
Salvatore:
I want to generate a map legend with number
in scientific format. (I have number like
1.0E+14 and in the legend appear like
100000000000000)…
oh yeah, a quick work-around thanks to Dylan:
the values you specify with the d.legend use=
option will appear verbatim on the screen. It means
you have to decide a series of class thresholds
instead of using a smooth legend, but gets the job
done.
see wish #1147; this was designed for use with log
scale data.
Hamish