I am trying to create a radar plot in plotly
. I am not sure how to add multiple lines to the same plot. I could find the add_trace
option in plotly.graph_objects as go
(https://plotly.com/python/radar-chart/). But I am not sure how to add multiple lines to the same plot while using px.line_polar
in plotly_express
.
import plotly.express as px
import pandas as pd
df1 = pd.DataFrame(dict(
r=[1, 5, 2, 2, 3],
theta=['processing cost', 'mechanical properties', 'chemical stability',
'thermal stability', 'device integration']))
df2 = pd.DataFrame(dict(
r=[.1, .5, .2, .2, .3],
theta=['processing cost', 'mechanical properties', 'chemical stability',
'thermal stability', 'device integration']))
fig = px.line_polar(df1, r='r', theta='theta', line_close=True)
fig.show()
Suggestions on how to include df2
in the same figure and also include corresponding legends will be really helpful.