Hello all,
I just installed plotly express. And I am trying to do something simple - plot each column of my data frame on the same y-axis with the index as x-axis. Here are questions/observations:
- Is it necessary for the data frame to have index as a column to be used as x-axis ? Can I not directly use the index for x-axis?
- How can I add multiple traces as were called in plotly on y-axis for the same x-axis ?
Here is some sample code :
import plotly.express as px
import pandas as pd
import numpy as np
# Get some data
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
# Plot
fig = px.line(df, x='Date', y='AAPL.High')
# Only thing I figured is - I could do this
fig.add_scatter(x=df['Date'], y=df['AAPL.Low']) # Not what is desired - need a line
# Show plot
fig.show()