# Setting equal data aspect ratio (x, y, z) using grdview

When I want an equal data aspect ratio for 2-D Cartesian axes, I use e.g. `-JX6i/0` to automatically scale the height of the plot. Now I’m using `grdview` to plot a 3-D perspective view of a (UTM-projected) DEM and I’m trying to scale the z-axis to match the equally scaled x- and y-axes. That is, I don’t want any vertical exaggeration. Currently I have e.g. `-JX6i/0 -JZ1.5i`. I guess I could calculate the appropriate vertical axis length programmatically from the data z-limits, but I first wanted to check if there’s a snazzier way. Thanks, all!

There is not, since there is no coupling between the x/y and the z data here. You’ll have to do the math. If you instead used -Jx1:xxxxxxxx for scale instead of -JX perhaps it is possible to give -Jx1:xxxxxxx a well (not sure - has not come up before). That would make it simpler to just pick one common scale.

1 Like

Mean -Jz1:xxxxx for the second case, i.e., same for -Jx and -Jz.

Thanks, Paul. Using the scale syntax does allow for the specification of an equal aspect ratio. MWE:

``````gmt basemap -R0/2/0/2/0/2 -Jx1i -Jz1i -Ba1 -Bza1 -p225/30 -png axis_equal
``````

BTW @pwessel in the above command, `-Jx1i` seemed to be interpreted as `-Jx1i/0`, i.e. `-Jx1i/1i`. Is this the default action for `-Jx` — to assume equal aspect ratio is desired (makes sense)?

Yes, for Cartesian (-Jx or -JX) we assume same for x and y unless you separate by slash.

1 Like