Is there a way to iterate through a list of marker symbols for a dash lines+markers graph? I am colorblind so 4 lines with circles don’t mean anything to me (even with the legend).
here’s my code for the dash app and there are 4 different study arms that I would like to have 4 different marker symbols. I’ve tried all the tricks that I know for jupyter notebook, but those aren’t working for Dash:
cart_pv = pd.pivot_table(jsw,index=['visit_label'], columns = ['study_arm'], values=['Med_JSW', 'Lat_JSW', 'Med_JSN',
'Lat_JSN'])
xax = cart_pv.index
cartilage_cols = ['Med_JSW', 'Lat_JSW', 'Med_JSN', 'Lat_JSN']
study_arms = list(set(jsw['study_arm']))
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='some title'),
html.Div(children='''Location Options'''),
dcc.Dropdown(
id='location',
options=[{'label': i, 'value': i} for i in cartilage_cols],
value=cartilage_cols[0]
),
dcc.Graph(id='cartilage')
])
@app.callback(
dash.dependencies.Output('cartilage', 'figure'),
[dash.dependencies.Input('location', 'value')])
def update_graph(location_name):
traces = []
for i in study_arms:
yax = cart_pv[:][location_name,i]
trace = {'x': xax, 'y': yax, 'name': i}
traces.append(trace)
return {'data': traces,
'layout': go.Layout(title='some graph title')
}
#debug=True might cause Flask web server to hang on Exit
if __name__ == '__main__':
app.run_server(debug=False)
Below is a picture of the graph. Any help would be much appreciated.
I recommend placing a debugger in your code so that you can debug the code yourself by printing out different variables. To insert a debugger:
install ipdb:
pip install ipdb
insert a debugging statement in your code
import ipdb; ipdb.set_trace()
and then you should be able to print out different variables. You can insert the statement directly above where you are having trouble.
Thank You. However, this just points to the marker line code as the error. I will scrap this and go back to jupyter notebook. Much appreciated for the feedback. The colorblindness makes it difficult to work in something that’s not easy to iterate through different marker shapes. Jupyter’s way is much easier.