1

I am using Spyder IDE. I am trying to get my plots to show but they won't show for some reason. X and Y axes are values from 2 separate dataframes. Code is as below.

    import plotly.graph_objects as go

    fig = go.Figure()

    fig.add_trace(go.Scatter(x=AsthmaCases.DataValue, y=dfCombinedToPlot.CasesPer100kPop, mode='lines', name='Asthma'))
    fig.show()

What is wrong or am I wrong in expecting fig.show() to have displayed my plot?

1

1 Answer 1

2

Here is a working solution:

from plotly.offline import plot
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(x=[0, 1], y=[2, 3], mode='lines', name='Asthma'))
plot(fig)

A related question is there: Plotly: How to display charts in Spyder?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.