Hello,
I’m trying to overlay 3 histograms. I need 2/3 (trace2 and trace3) entries to be just lines around the histogram bars, but not filled with any colors. What’s the option for that? In the example picture which is the output of the following code, trace “Main” doesn’t appear in the right color unless it is added the last. I need the other to to be just lines, so that I don’t have to play with the order of traces each time.
My code is
trace_hist1 = go.Histogram(x=df_com[df_com['time-point']<20]["time-point"],
opacity=0.7,
marker_color='green',
name='Main',
nbinsx=int((20-0)/1)
)
trace_hist2 = go.Histogram(x=match_results["matching_line_time_point"],
opacity=0.5,
marker=dict(color='blue', line=dict(color='blue', width=2)),
name='Prediction',
nbinsx=int((20-0)/1)
)
trace_hist3 = go.Histogram(
x=random_match_results["matching_line_time_point"],
histfunc='count',
opacity=0.5,
marker=dict(color='red', line=dict(color='red', width=2)),
name='Random Assignment',
nbinsx=int((20 - 0) / 1)
)
layout = go.Layout(barmode='overlay')
fig = go.Figure(data=[trace_hist1, trace_hist2, trace_hist3], layout=layout)
fig.update_layout(
template = "ggplot2",
width=1000, height=400,
title=canvas_title,
title_x=0.1,
title_y=0.9,
title_font=dict(size=20),
)
fig.update_yaxes(type="log")
fig.update_xaxes(title_text="Time points") # Change the x-axis title
fig.update_yaxes(title_text="Number of entries") # Change the y-axis title
fig.show()