Note
Click here to download the full example code
07. Plot Parallel
This example plots a parallel graph.
9 import plotly.graph_objects as go
10 import pandas as pd
11
12 from plotly.io import show
13
14 try:
15 __file__
16 TERMINAL = True
17 except:
18 TERMINAL = False
19
20
21 # Load
22 df = pd.read_csv("https://raw.githubusercontent.com/bcdunbar/datasets/master/parcoords_data.csv")
23
24 # Visualize
25 if TERMINAL:
26 print("\nData:")
27 print(df)
28 df
29
30 # Show
31 fig = go.Figure(data=
32 go.Parcoords(
33 line = dict(color = df['colorVal'],
34 colorscale = 'Electric',
35 showscale = True,
36 cmin = -4000,
37 cmax = -100),
38 dimensions = list([
39 dict(range = [32000,227900],
40 constraintrange = [100000,150000],
41 label = "Block Height", values = df['blockHeight']),
42 dict(range = [0,700000],
43 label = 'Block Width', values = df['blockWidth']),
44 dict(tickvals = [0,0.5,1,2,3],
45 ticktext = ['A','AB','B','Y','Z'],
46 label = 'Cyclinder Material', values = df['cycMaterial']),
47 dict(range = [-1,4],
48 tickvals = [0,1,2,3],
49 label = 'Block Material', values = df['blockMaterial']),
50 dict(range = [134,3154],
51 visible = True,
52 label = 'Total Weight', values = df['totalWeight']),
53 dict(range = [9,19984],
54 label = 'Assembly Penalty Wt', values = df['assemblyPW']),
55 dict(range = [49000,568000],
56 label = 'Height st Width', values = df['HstW'])])
57 )
58 )
59
60 # Show
61 show(fig)
Total running time of the script: ( 0 minutes 1.854 seconds)