我有下面的图片,我想删除点和三角形以外的所有东西,这意味着水平和垂直轴上的数字以及小的垂直线,我该怎么办?
这是图片:
这是我的代码:
x0 = np.average(triangleEdges,axis=0,weights=np.array([0.2,0.1,0.7]))[0]
y0 = np.average(triangleEdges,axis=0,weights=np.array([0.2,0.1,0.7]))[1]
x1 = np.average(triangleEdges,axis=0,weights=np.array([0.5,0.1,0.7]))[0]
y1 = np.average(triangleEdges,axis=0,weights=np.array([0.5,0.1,0.7]))[1]
trace0 = go.Scatter(
x=[x0],
y=[y0],
marker = dict(
size = 15,
color = 'rgba(25, 181, 254, 1)',
line = dict(
width = 1,
color = 'rgb(0, 0, 0)'
)
)
)
trace1 = go.Scatter(
x=[x1],
y=[y1],
marker = dict(
size = 15,
color = 'rgba(152, 0, 0, .8)',
line = dict(
width = 1,
color = 'rgb(0, 0, 0)'
)
)
)
data = [trace0,trace1]
layout = {
'xaxis': {
'range': [0.2, 1],
'zeroline': False,
},
'yaxis': {
'range': [0, 1],
'showgrid': False,
},
'shapes': [
# filled Triangle
{
'type': 'path',
'path': ' M 0.2 0 L 1 0 L 0.6 1 Z',
'fillcolor': 'rgba(44, 160, 101, 0.5)',
'line': {
'color': 'rgb(44, 160, 101)',
},
},
]
}
fig = {
'data': data,
'layout': layout,
}
py.iplot(fig, filename='shapes-path')
我试图四处看看,但什么也没找到。
非常感谢您!
答案 0 :(得分:2)
要在较新版本中关闭轴:
#legend
df.update_layout(showlegend=False)
#x axis
df.update_xaxes(visible=False)
#y axis
df.update_yaxes(visible=False)
答案 1 :(得分:0)
要关闭轴:
'xaxis': {
'range': [0.2, 1],
'showgrid': False, # thin lines in the background
'zeroline': False, # thick line at x=0
'visible': False, # numbers below
}, # the same for yaxis
如果您想删除图例,也要
layout = {
'showlegend': False,
...