I have the following dataframe:
I want to add two lines in the same plot. Essentially landed_value_millions
and wholesale_values_millions
plotted over years
.
The following code, which I got from Line Plot Modes gives the error ValueError: Invalid value of type 'builtins.str' received for the 'x' property of scatter. Received value: 'year' The 'x' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
import plotly.graph_objects as go
salmon_value = go.Figure()
salmon_value.add_trace(go.Scatter(x='year', y='wholesale_values_millions',
mode='lines',
name='whole sale value'))
salmon_value.add_trace(go.Scatter(x='year', y='landed_value_millions',
mode='lines+markers',
name='landed value'))
salmon_value.show()
Anybody know how to fix this? Thank you.