Parallel Plot for Cateogrical and Continuous variable by Plotly Express
Goal¶
This post aims to introduce how to draw Parallel Plot for categorical and continuous variable by Plotly Express
Reference
Libraries¶
In [19]:
import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.renderers.default = "png"
Create continuous data¶
In [4]:
df = px.data.election()
df.head()
Out[4]:
Visualize Parallel Plot for continuous data¶
In [20]:
fig = px.parallel_coordinates(df,color='total', color_continuous_scale=px.colors.sequential.Inferno)
fig
Create categorical data¶
In [9]:
df = px.data.election()
df.head()
Out[9]:
Visualize Parallel for continuous data¶
In [21]:
fig = px.parallel_categories(df, color="total", color_continuous_scale=px.colors.sequential.Inferno)
fig
Comments
Comments powered by Disqus