Created
October 15, 2020 16:16
-
-
Save janbenetka/a3eefda0500c7eb7d432954284e44742 to your computer and use it in GitHub Desktop.
[Parallel plot for ranked data] #plotly #ranking #pandas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.express as px | |
df = px.data.iris() | |
fig = px.parallel_coordinates(df, color="species_id", | |
dimensions=['sepal_width', 'sepal_length', 'petal_width', | |
'petal_length'], | |
color_continuous_scale=px.colors.diverging.Tealrose, | |
color_continuous_midpoint=2) | |
fig.show() | |
#----------------------------------- | |
import plotly.graph_objects as go | |
fig = go.Figure(data= | |
go.Parcoords( | |
line_color=['black', 'orange'], | |
dimensions = list([ | |
dict(range = [top_netflow_comp.person_net_flow_2019.min(),top_netflow_comp.person_net_flow_2019.max()], | |
tickvals = top_netflow_comp.person_net_flow_2019, | |
label = '2019', values = top_netflow_comp.person_net_flow_2019, | |
ticktext = top_netflow_comp.state_name), | |
dict(range = [top_netflow_comp.person_net_flow_2020.min(),top_netflow_comp.person_net_flow_2020.max()], | |
tickvals = top_netflow_comp.person_net_flow_2020, | |
label = '2020', values = top_netflow_comp.person_net_flow_2020, | |
ticktext = top_netflow_comp.state_name), | |
]) | |
) | |
) | |
fig.update_layout( | |
plot_bgcolor = 'white', | |
paper_bgcolor = 'white', | |
height=1500, | |
width=700, | |
title='Net flow in 2019 vs 2020' | |
) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment