Python에서 Plotly를 사용하여 대시보드를 만들려고 합니다. 대시보드를 초기화하고 'dash_html_components.Div()'를 사용하여 부분/컨테이너로 나눴습니다. 나중에 'dash_core_components.Graph()'를 사용하여 div 내부에 그래프를 그렸습니다. 그래프에서 X, Y축 선을 없애고 싶습니다.
그래프 레이아웃 코드:
layout_my_graph = go.Layout(
autosize = True,
margin={'t': 35,'r': 20,'b': 30,'l': 40},
legend=dict(
x=.9,y=1,
traceorder='normal',
font=dict(size=12)
),
#'t' in margin refer to top of the graph.
#Similarly you can set margin={'l': ?, 'r': ?, 't': ?, 'b':
title = "Commodity Price",
xaxis = dict(
title = "Dates",
linecolor = "#BCCCDC", # Sets color of X-axis line
showgrid = False, # Removes X-axis grid lines
zeroline = False, # thick line at x=0
visible = True, # numbers below
showspikes = True, #shows vertical line on hover
spikemode = 'toaxis+across', #shows vertical line on hover
spikesnap = 'cursor',
spikedash = 'solid', #shows vertical line on hover
spikecolor = "#000000",
spikethickness = 1
),
yaxis = dict(
title="Price",
linecolor="#BCCCDC", # Sets color of Y-axis line
showgrid=True, # Removes Y-axis grid lines
zeroline = False, # thick line at x=0
visible = True, # numbers below
),
showlegend = True, #shows vertical line on hover
hovermode = 'x', #shows vertical line on hover
spikedistance = -1 #shows vertical line on hover
)
fig = {
'data': traces,
'layout': layout_my_graph
}
xaxis = dict(
# title = "Dates",
linecolor = "#BCCCDC", # Sets color of X-axis line
showgrid = False, # Removes X-axis grid lines
zeroline = False, # thick line at x=0
showline = False, #removes X-axis line
showticklabels=True, # axis ticklabels
visible = True, # numbers below
showspikes = True, #shows vertical line on hover
spikemode = 'toaxis+across', #shows vertical line on hover
spikesnap = 'cursor',
spikedash = 'solid', #shows vertical line on hover
spikecolor = "#000000",
spikethickness = 1
),
yaxis = dict(
# title="Price",
linecolor="#BCCCDC", # Sets color of Y-axis line
showgrid=True, # Removes Y-axis grid lines
zeroline = False, # thick line at x=0
showline = False, #removes Y-axis line
showticklabels=True, # axis ticklabels
visible = True, # numbers below
)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다