Consider the following snippet:
fig = go.Figure(
data=[
go.Surface(
x=list(range(1,20)),
y=list(range(1,10)),
z=np.random.random(size=(20,10))
)
]
)
fig.update_layout(
autosize=False,
width=1200,
height=800,
)
which yields:
Problem: Note that not all the x-axis range is plotted! Following snippet tries to fix it:
fig = go.Figure(
data=[
go.Surface(
x=list(range(1,20)),
y=list(range(1,10)),
z=np.random.random(size=(20,10))
)
]
)
fig.update_layout(
autosize=False,
width=1200,
height=800,
scene=dict( # Adding explicit x/y ranges
xaxis = dict(range=[0,20]),
yaxis = dict(range=[0,10]),
),
)
yields:
Problem: Better. But still, the Z-data is not shown for the 10-20 range of the x-axis. Final attempt:
fig = go.Figure(
data=[
go.Surface(
x=list(range(1,20)),
y=list(range(1,10)),
z=np.random.random(size=(10,20)) # note the change in the order of the arguments of the size
)
]
)
fig.update_layout(
autosize=False,
width=1200,
height=800,
scene=dict(
xaxis = dict(range=[0,20]),
yaxis = dict(range=[0,10]),
),
)
yields the expected result:
Question: What am I missing here? This is a little counterintuitive.