-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparallel_plot.py
More file actions
46 lines (37 loc) · 2 KB
/
parallel_plot.py
File metadata and controls
46 lines (37 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import plot_data
from plot_data.colors import *
import random
elements = []
SHAPES = ['round', 'square', 'triangle', 'ellipse']
COLORS = [RED, BLUE, GREEN, YELLOW, ORANGE, VIOLET]
for i in range(50):
random_shape = SHAPES[random.randint(0, len(SHAPES) - 1)]
random_color = COLORS[random.randint(0, len(SHAPES) - 1)]
elements.append({'mass': random.uniform(0, 50),
'length': random.uniform(0, 100),
'shape': random_shape,
'color': random_color
})
parallelplot = plot_data.ParallelPlot(elements=elements,
axes=['mass', 'length', 'shape', 'color'])
# The line above shows the minimum requirements for creating a
# parallel plot. However, many options are available for further customization.
# 'edge_style' option allows customization of the lines
edge_style = plot_data.EdgeStyle(line_width=1, color_stroke=VIOLET, dashline=[])
# 'disposition' = 'vertical' or 'horizontal' whether you want the axis to be
# vertical of hozizontal. This can be changed by pressing the 'disp' button on
# canvas as well.
disposition = 'horizontal'
# Next, ParallelPlots "sort" an axis when clicking on it by displaying a color
# interpolation on the lines. When the attribute 'rgbs' is not given to the ParallePlot
# it is set to [red, blue, green]. However, users are free to set as many
# colors as they want, as long as they are in rgb. A wide panel of rgb colors
# are available in plot_data/colors.py
rgbs = [BLUE, YELLOW, ORANGE]
customized_parallelplot = plot_data.ParallelPlot(elements=elements,
axes=['mass', 'length', 'shape', 'color'],
edge_style=edge_style,
disposition=disposition,
rgbs=rgbs)
# if debug_mode == True, set it to False
plot_data.plot_canvas(plot_data_object=customized_parallelplot, debug_mode=True)