Ask Your Question

Revision history [back]

The questions seems to split into two questions.

  • Why do we get such different graphs when using list_plot3d with spline interpolation, starting from two 3D point sets whose only difference is a scaling of the z-values?

  • How can we change the (x, y, z) aspect ratios when viewing a plot?

Why are the graphs so different?

I don't have an answer here...

Here is slightly rewritten code to reproduce the problem.

nx, ny = 74, 90

def fx(x):
    return 0.5 + x/2.5

def fy(y):
    return 40*y

def g(x, y):
    xx = 30 * (fx(x/nx) - 1/2) + 1/2
    yy = fy(y/ny)
    zz = 5 * abs(zeta(fx(x/nx) + I*fy(y/ny)))
    return xx, yy, zz

gxyz = [g(x, y)
        for x in range(-nx, nx+1)
        for y in range(-ny, ny+1)]

g_plot = list_plot3d(gxyz, interpolation_type='spline')
g_plot.show()

hxyz = [(x, y, z/5) for x, y, z in gxyz]
h_plot = list_plot3d(hxyz, interpolation_type='spline')
h_plot.show(aspect_ratio=(1, 1, 10))

One would expect the graphs to be scaled versions of each other, but that's far from being the case!

This is possibly revealing a bug.

How to apply different x, y, z scalings to a 3D plot?

Use aspect_ratio as above, adapting to the need.

For instance, to get the bounding box for g_plot closer to a cube:

g_plot.show(aspect_ratio=(3, 1, 4))