Grdview – How to properly scale z-axis?

I’m struggling with the docs here a bit. I’m plotting a perspective view of the Innsbruck, Austria area.

gmt grdview @earth_relief_15s -Cwhite,white -I -R10.5/12.2/46.7/47.8 -Jl11.5/47/46.5/47.5/15c -Jz0.0002c -p165/30 -Qs -png INN3d_15

My problem is that I need that plot 15 cm wide and I don’t understand how to scale the z-axis to be proportional to the x- and y-axis.

I’m sure this is super easy but at the moment I don’t see the forest for the trees. Your help is greatly appreciated!

Mmm… I think that you should work with scale on the three axis. For example, to see what is the scale in the x/y-axis and choose a proper scale for the z-axis.

Maybe this post could help. Setting equal data aspect ratio (x, y, z) using grdview

But the horizontal axes are degrees and meters on the vertical. Do you want to compute a 1:1 scale between horizontal and vertical scale? I mean, a vertical exaggeration of 1? You won’t see nothing then.

@Joaquim why won’t I see anything? You mean the vertical displacement is too small so see for the given area?

@Esteban82 thank you for finding that post – unfortunately not too promising …

Because the horizontal dimensions are much larger than the vertical. On a mountain 6% slope is when you get those driving warnings (road signs) “break with the engine”. But 6% is a low slope when one want to show relief. That’s why we need to exaggerate 5 to 10 times to show a relief, otherwise nature is boringly flat on a piece of paper (or computer screen).

That’s understood, @Joaquim. Thank you. I can confirm it is the same effect from 12km altitude.

Do you have a suggestion how to achieve the same vertical exaggeration over several different plots? So they are somewhat comparable? As I understand it there is no way to feed the desired vertical exaggeration directly to grdview?

My current thinking is to calculate the scale for a given plot width and feed it to -Jz after multiplying it with my desired vertical exaggeration factor.

Ops, for a moment I forgot that you have a much better perspective than mine.

You can use a -Jz1:xxxxx so that should allow you to have the same vertical scale in different plots.

@Joaquim it seems grdview doesn’t like -Jz1:100000:

gmt grdview @earth_relief_15s -Cwhite,white -I -R10.5/12.2/46.7/47.8 -Jl11.5/47/46.5/47.5/15c -Jz1:100000 -p165/30 -Qs -png INN3d_15

Results in a warning and no plot:
grdview [WARNING]: 1:100000 not a valid number and may not be decoded properly.

What am I missing?

Parsing 1:xxxxx for z-axes was not implemented. So unlike 1:xxxxx in map projections, I guess for z this should mean xxxxx z-units should equal 1 cm in the vertical direction?

So a bit rediscovery (I dont use 1:xxxx very often). For map projections, 1:xxxxx basically says a 1 meter plot equals xxxxx meter in real life. Right now, after allowing 1:zzzzz to be parsed I get the same effect, i.e, there is a factor of 100 in there to relate distances to plot height in meter. So if z-range is 0/5 (whatever z is, say temperature or mGal) and -Jz1:100 is given, then the z-axis plot length is 5 cm, so 5/100 is 0.05 and hence there is that factor of 100. I would have thought -Jz1:1 would mean one z unit (mGal or degree C) is 1 cm, but it is 1 meter. I think this is not what we want for the z-axis. Thoughts?

Hi @pwessel I think there are two use-cases for the z-axis:

  • plot altitudes – meters are fine, other units would be great, having some way to easily set a fixed vertical exaggeration so it matches with other data (i.e. when used together with DEM) would also be helpful.
  • plot some values for relative comparison (temperatures, mGal, unicorns) I guess “looks good” is the metric for a proper plot here? Scaling of z-axis has most probably little to to with x- and y-axis

For my special use case meters are fine as I’m trying to plot altitudes (flight tracks). Just need to precondition my data (in aviation altitudes are measured in feet …)

Hi Kristof

I was just playing with grdview and wanted more vertical exaggeration on the thing I was plotting. Turns out, rather than mess with the Z axis, I just set that as tall as I needed it (-JZ8c) for 8cm and then used the R option to give desired Zmin and Zmax. This had the effect of exaggerating things in the Z-direction my range on Z was small compared to the range in X/Y.

HI @RunningWild,

that’s a nice idea, thank you! My problem is, that I plot different areas with different terrain features but I want them to be comparable. So not much luck for me by just giving the desired height. A plot from the Alps will always be taller than a plot from the German coast and I want that difference to be visible/comparable.

Just a follow-up that Paul implemented parsing -Jz1:zzzzzz for vertical scale in the GitHub repo (