如何改变痕迹中标记的外观?
e.g。在下面的示例中,如何将每个标记的不透明度设置为特定值(例如,基于opacity_data列表)
似乎这应该是可能的,但我没有取得任何成功。在此先感谢您的帮助,
dusiod
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
app = dash.Dash()
x_data = list(range(1,11))
y_data = [i**2 for i in x_data]
opacity_data = [i / i**2 for i in x_data]
app.layout = html.Div([
dcc.Graph(id='test',
figure=go.Figure(
data=[go.Scatter(
x=x_data,
y=y_data,
mode='markers',
opacity=1)]
))
])
app.run_server()
答案 0 :(得分:0)
它点击了......根据下面的气泡图示例,在字典中的列表中指定了标记特定信息。
[https://plot.ly/python/bubble-charts/][1]
import plotly.plotly as py
import plotly.graph_objs as go
trace0 = go.Scatter(
x=[1, 2, 3, 4],
y=[10, 11, 12, 13],
mode='markers',
marker=dict(
color=['rgb(93, 164, 214)', 'rgb(255, 144, 14)',
'rgb(44, 160, 101)', 'rgb(255, 65, 54)'],
opacity=[1, 0.8, 0.6, 0.4],
size=[40, 60, 80, 100],
)
)
data = [trace0]
py.iplot(data, filename='bubblechart-color')