I am using the following code to create a simple plotly line chart in Python. I have two variables (at the bottom of the code):
ctime
amount
ctime just using the current time for each element in amount; there are 10 times amount is a contained of amounts ranging from 0-1000; the are ten amounts
I want to color my plot markers in the following way:
amount is less than 300; that specific marker for that value will be green amount is between 300 and 400; that specific marker for that value will be yellow amount is greater than 400; that specific marker for that value will be red
Is there any way I can build in a conditional type handler for this?
layout = Layout(
title='Current Amount',
titlefont=Font(
family='"Open sans", verdana, arial, sans-serif',
size=17,
color='#444'
),
font=Font(
family='"Open sans", verdana, arial, sans-serif',
size=12,
color='#444'
),
showlegend=True,
autosize=True,
width=803,
height=566,
xaxis=XAxis(
title='Time',
titlefont=Font(
family='"Open sans", verdana, arial, sans-serif',
size=14,
color='#444'
),
range=[1418632334984.89, 1418632334986.89],
domain=[0, 1],
type='date',
rangemode='normal',
autorange=True,
showgrid=False,
zeroline=False,
showline=True,
autotick=True,
nticks=0,
ticks='inside',
showticklabels=True,
tick0=0,
dtick=1,
ticklen=5,
tickwidth=1,
tickcolor='#444',
tickangle='auto',
tickfont=Font(
family='"Open sans", verdana, arial, sans-serif',
size=12,
color='#444'
),
mirror='allticks',
linecolor='rgb(34,34,34)',
linewidth=1,
anchor='y',
side='bottom'
),
yaxis=YAxis(
title='GHI (W/m2)',
titlefont=Font(
family='"Open sans", verdana, arial, sans-serif',
size=14,
color='#444'
),
range=[-5.968375815056313, 57.068375815056314],
domain=[0, 1],
type='linear',
rangemode='normal',
autorange=True,
showgrid=False,
zeroline=False,
showline=True,
autotick=True,
nticks=0,
ticks='inside',
showticklabels=True,
tick0=0,
dtick=1,
ticklen=5,
tickwidth=1,
tickcolor='#444',
tickangle='auto',
tickfont=Font(
family='"Open sans", verdana, arial, sans-serif',
size=12,
color='#444'
),
exponentformat='B',
showexponent='all',
mirror='allticks',
linecolor='rgb(34,34,34)',
linewidth=1,
anchor='x',
side='left'
),
legend=Legend(
x=1,
y=1.02,
traceorder='normal',
font=Font(
family='"Open sans", verdana, arial, sans-serif',
size=12,
color='#444'
),
bgcolor='rgba(255, 255, 255, 0.5)',
bordercolor='#444',
borderwidth=0,
xanchor='left',
yanchor='auto'
)
)
new_data = Scatter(x=ctime, y=amount)
data = Data( [ new_data ] )
