import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
import numpy as np
x, y, z = np.random.multivariate_normal(np.array([0,0,0]), np.eye(3), 200).transpose()
trace1 = go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
marker=dict(
size=12,
line=dict(
color='rgba(217, 217, 217, 0.14)',
width=0.5
),
opacity=0.8
)
)
data = [trace1]
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
),
xaxis=dict(type='log',
autorange=True,
title="L1")
)
fig = go.Figure(data=data, layout=layout)
iplot(fig, filename='simple-3d-scatter')
这是文档中的示例,https://plot.ly/python/3d-scatter-plots/我稍微修改为
但是,Plotly 似乎(默默地)忽略了我的轴设置,因为我得到了这个并且没有收到任何错误/警告:
您可能会注意到,我希望它具有的既不是对数刻度也不是 L1
轴标签。
我该如何解决这个问题? Python 3.6.8,Plotly 版本 3.6.1,在 Jupyter notebook 中绘图(离线模式)。
在 virtualenv 中尝试 plotly 3.3:
最佳答案
在 scene
字典中指定轴属性,如下所示:
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
),
scene=dict(
xaxis=dict(
type='log',
autorange=True,
title='L1')
)
)
关于python - 如何巧妙地不忽略我的轴设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55447473/