"nticks" 情节场景中的 xaxis 不被尊重
"nticks" not being respected for xaxis in plotly scene
让我们从代码开始:
b_min = [-3, 6, 0]
b_max = [24, 24, 9]
n_vertices = [10, 10, 10]
p_a = [-1, 11, 4.5]
p_b = [11, 9, 9]
p_c = [6, 8, 6]
p_d = [-1, 7, 10]
points = [p_a, p_b, p_c, p_d]
df = pd.DataFrame(points, columns=['x', 'y', 'z'])
figure = px.scatter_3d(df, x='x', y='y', z='z')
figure.update_layout(scene={
'xaxis': {'nticks': n_vertices[0], 'range': [b_min[0], b_max[0]]},
'yaxis': {'nticks': n_vertices[1], 'range': [b_min[1], b_max[1]]},
'zaxis': {'nticks': n_vertices[2], 'range': [b_min[2], b_max[2]]}
})
figure.show()
我期望每个轴有 10 个刻度。这适用于 y 轴和 z 轴,但不适用于 x。为什么?
查看scatter3d traces的文档here,nticks
是一个轴的最大刻度数,实际刻度数小于等于nticks
.
让我们从代码开始:
b_min = [-3, 6, 0]
b_max = [24, 24, 9]
n_vertices = [10, 10, 10]
p_a = [-1, 11, 4.5]
p_b = [11, 9, 9]
p_c = [6, 8, 6]
p_d = [-1, 7, 10]
points = [p_a, p_b, p_c, p_d]
df = pd.DataFrame(points, columns=['x', 'y', 'z'])
figure = px.scatter_3d(df, x='x', y='y', z='z')
figure.update_layout(scene={
'xaxis': {'nticks': n_vertices[0], 'range': [b_min[0], b_max[0]]},
'yaxis': {'nticks': n_vertices[1], 'range': [b_min[1], b_max[1]]},
'zaxis': {'nticks': n_vertices[2], 'range': [b_min[2], b_max[2]]}
})
figure.show()
我期望每个轴有 10 个刻度。这适用于 y 轴和 z 轴,但不适用于 x。为什么?
查看scatter3d traces的文档here,nticks
是一个轴的最大刻度数,实际刻度数小于等于nticks
.