[GRASS-user] Labelling in gis.m profile tool

Does the gis.m profiler now have additional labels on the x and y axes? I've updated to the latest cvs along with make distclean, but the profiler only labels the maximum and minimum on the y-axis. IIRC, there was some discussion between Michael and Hamish about recent improvements to the profiler, but I can't locate the thread.

OTOH, if I've misunderstood the improvements, I'd like to file additional profile axis labels as a wish.

~ Eric.

Patton, Eric wrote:

Does the gis.m profiler now have additional labels on the x and y
axes? I've updated to the latest cvs along with make distclean, but
the profiler only labels the maximum and minimum on the y-axis. IIRC,
there was some discussion between Michael and Hamish about recent
improvements to the profiler, but I can't locate the thread.

http://thread.gmane.org/gmane.comp.gis.grass.devel/18260

OTOH, if I've misunderstood the improvements, I'd like to file
additional profile axis labels as a wish.

The profiler (or for that matter the GIS) has no idea what the units of
the raster map are, so the y axis can't be labeled. There is no
formalized raster map meta-data spot for that so we can't just pluck it
from the map, and assuming meters is Bad.

One thing I'd still like to see in the profiler tools is the x-axis
converted to km if the total transect distance is longer than 2500m.
(The gis function that reports distance between two points always
converts and outputs in meters, I haven't checked but I suspect that
using the Location's $mapunits as the x-axis units may be an error)

Something like this: (needs more work)

--- profile.tcl 2007-03-06 18:15:12.000000000 +1300
+++ profile.tcl.to_km 2007-02-19 23:12:49.000000000 +1300
@@ -507,12 +507,13 @@
                -text [G_msg "distance along transect ($mapunits)"] \
                -anchor n \
                -justify center
-
+
        # add transect segment markers
        foreach {x} $pcoordslist {
                if { $tottlength > 0.0 } {
                        set segx [expr $left + (($x * $width) / $tottlength)]
                        $pcan create line $segx $bottom $segx $top -fill grey
+ if { $tottlength > 2500.0 } { set x [expr $x/1000.0] }
                        $pcan create text $segx $top -text "[format %g $x]" \
                                -anchor s -justify center -fill grey
                }
@@ -520,8 +521,13 @@

        # add label for total transect distance
+ if { $tottlength > 2500.0 } {
+ set x [expr $tottlength/1000.0]
+ } else {
+ set x $tottlength
+ }
        $pcan create text $right $xscaletop \
- -text "[format %g $tottlength]" \
+ -text "[format %g $x]" \
                -anchor n \
                -justify center

Hamish

Patton, Eric wrote:

Does the gis.m profiler now have additional labels on the x and y
axes? I've updated to the latest cvs along with make distclean, but
the profiler only labels the maximum and minimum on the y-axis. IIRC,
there was some discussion between Michael and Hamish about recent
improvements to the profiler, but I can't locate the thread.

Hamish:

The profiler (or for that matter the GIS) has no idea what the units of
the raster map are, so the y axis can't be labeled. There is no
formalized raster map meta-data spot for that so we can't just pluck it
from the map, and assuming meters is Bad.

Would there be a way to fit in an optimal number of labels soley based on the amount of postscript space being used by the y-axis? The profiler seems to output an eps of the same dimensions each time, so couldn't the label size be used as a unit of measurement itself for fitting additional labels along each axis? Like an equal interval spacing or something.

~ Eric.

I thought I did this. But I've been in the hospital and maybe the code
didn't get submitted somehow.

Michael

On 3/8/07 8:09 AM, "Patton, Eric" <epatton@nrcan.gc.ca> wrote:

Does the gis.m profiler now have additional labels on the x and y axes? I've
updated to the latest cvs along with make distclean, but the profiler only
labels the maximum and minimum on the y-axis. IIRC, there was some discussion
between Michael and Hamish about recent improvements to the profiler, but I
can't locate the thread.

OTOH, if I've misunderstood the improvements, I'd like to file additional
profile axis labels as a wish.

~ Eric.

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 3/9/07 7:04 AM, "Patton, Eric" <epatton@nrcan.gc.ca> wrote:

Patton, Eric wrote:

Does the gis.m profiler now have additional labels on the x and y
axes? I've updated to the latest cvs along with make distclean, but
the profiler only labels the maximum and minimum on the y-axis. IIRC,
there was some discussion between Michael and Hamish about recent
improvements to the profiler, but I can't locate the thread.

Hamish:

The profiler (or for that matter the GIS) has no idea what the units of
the raster map are, so the y axis can't be labeled. There is no
formalized raster map meta-data spot for that so we can't just pluck it
from the map, and assuming meters is Bad.

Would there be a way to fit in an optimal number of labels soley based on the
amount of postscript space being used by the y-axis? The profiler seems to
output an eps of the same dimensions each time, so couldn't the label size be
used as a unit of measurement itself for fitting additional labels along each
axis? Like an equal interval spacing or something.

~ Eric.

Eric,

Are you referring to axis labels or tick marks? As Hamish pointed out, there
is no way to know what units the y axis is in.

There is probably a way to optimize the number of tick marks, but I haven't
worked it out and it may be complicated across different system
architectures. The axes have to be drawn in pixels, mm, cm, or inches
(though I'm not sure how consistent the relationship between pixels and
distance units is across systems). The fonts are in points. I don't think
that there is a consistent relationship between points and pixels across
systems either. Maybe the trick would be to draw the axes in inches.
However, automatic scaling is still kind of tricky (e.g., setting an
aesthetic max and min to the nearest 1/10/100...). You kind of need to do
that first to make nice tick marks (e.g., you wouldn't want tick marks that
represent divisions of 113.267 m)

I arbitrarily picked x and y axis lengths that seemed to "look pretty good".
However, they rescale dynamically as the window is changed. I was assuming
initially that most people would drop the eps into a graphics program to
touch it up if they wanted publishable quality. TclTk has some on-screen
page layout capabilities, but they are not particularly rich or strong.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Eric,

I was just able to check, and my updates to add a nice label to the x-axis
and distance values for transect segment markers is in the cvs. I did not
add any tick marks in that update.

Michael

On 3/10/07 1:02 PM, "Michael Barton" <michael.barton@asu.edu> wrote:

On 3/9/07 7:04 AM, "Patton, Eric" <epatton@nrcan.gc.ca> wrote:

Patton, Eric wrote:

Does the gis.m profiler now have additional labels on the x and y
axes? I've updated to the latest cvs along with make distclean, but
the profiler only labels the maximum and minimum on the y-axis. IIRC,
there was some discussion between Michael and Hamish about recent
improvements to the profiler, but I can't locate the thread.

Hamish:

The profiler (or for that matter the GIS) has no idea what the units of
the raster map are, so the y axis can't be labeled. There is no
formalized raster map meta-data spot for that so we can't just pluck it
from the map, and assuming meters is Bad.

Would there be a way to fit in an optimal number of labels soley based on the
amount of postscript space being used by the y-axis? The profiler seems to
output an eps of the same dimensions each time, so couldn't the label size be
used as a unit of measurement itself for fitting additional labels along each
axis? Like an equal interval spacing or something.

~ Eric.

Eric,

Are you referring to axis labels or tick marks? As Hamish pointed out, there
is no way to know what units the y axis is in.

There is probably a way to optimize the number of tick marks, but I haven't
worked it out and it may be complicated across different system architectures.
The axes have to be drawn in pixels, mm, cm, or inches (though I'm not sure
how consistent the relationship between pixels and distance units is across
systems). The fonts are in points. I don't think that there is a consistent
relationship between points and pixels across systems either. Maybe the trick
would be to draw the axes in inches. However, automatic scaling is still kind
of tricky (e.g., setting an aesthetic max and min to the nearest 1/10/100...).
You kind of need to do that first to make nice tick marks (e.g., you wouldn't
want tick marks that represent divisions of 113.267 m)

I arbitrarily picked x and y axis lengths that seemed to "look pretty good".
However, they rescale dynamically as the window is changed. I was assuming
initially that most people would drop the eps into a graphics program to touch
it up if they wanted publishable quality. TclTk has some on-screen page layout
capabilities, but they are not particularly rich or strong.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton