1

I am currently generating a line graph using plotly express and this is the code I used.

fig = px.line(run, x="day", y= 'infected', title= 'Mass Testing at 60% Simulations')


fig.update_layout(
    xaxis_title="Day",
    yaxis_title= measure.capitalize(),
    legend_title = 'Quarantine Delay (Days)',
    title={
        'y':0.9,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'}
)

py.plot(fig, filename= name + '.html')

This is what the dataset looks like:

enter image description here

It has 2 sets of days that are being compared. Plotly generates the lines I wanted but some reason a third line appears without any hover details appearing for that line (Highlighted in yellow on this picture).

enter image description here

I'm not really sure what is the problem, I double checked the dataset that there only has to be 2 sets of days being compared but somehow this 3rd line is being generated.

AminoAcid
  • 188
  • 9
  • Does this answer your question? [Unintended Additional line drawn by Plotly express in Python](https://stackoverflow.com/questions/60799206/unintended-additional-line-drawn-by-plotly-express-in-python) – vestland May 02 '20 at 22:14

1 Answers1

1

It is your 'day' column - you could guess by the fact it is linear.

Błotosmętek
  • 12,717
  • 19
  • 29
  • Oddly enough, it is. I tried converting the day to strings calling them "Day 0" and so forth yet for some reason, it's still generating the line for days. – AminoAcid May 02 '20 at 11:04