21
21
if test_scatter_plot:
23
data = Serie([ (-2,10), (0,0), (0,15), (1,5), (2,0), (3,-10), (3,5) ])
23
data = Series([ (-2,10), (0,0), (0,15), (1,5), (2,0), (3,-10), (3,5) ])
24
24
cairoplot.scatter_plot ( 'scatter_1_default_series.png', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
26
26
#lists of coordinates x,y
27
data = Serie([[[1,2,3,4,5],[1,1,1,1,1]]])
27
data = Series([[[1,2,3,4,5],[1,1,1,1,1]]])
28
28
cairoplot.scatter_plot ( 'scatter_2_lists_series.png', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
30
30
#lists of coordinates x,y,z
31
data = Serie([[[0.5,1,2,3,4,5],[0.5,1,1,1,1,1],[10,6,10,20,10,6]]])
31
data = Series([[[0.5,1,2,3,4,5],[0.5,1,1,1,1,1],[10,6,10,20,10,6]]])
32
32
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
33
33
cairoplot.scatter_plot ( 'scatter_3_lists_series.png', data = data, width = 500, height = 500, border = 20, axis = True, discrete = True,
34
34
grid = True, circle_colors = colors )
36
data = Serie([(-1, -16, 12), (-12, 17, 11), (-4, 6, 5), (4, -20, 12), (13, -3, 21), (7, 14, 20), (-11, -2, 18), (19, 7, 18), (-10, -19, 15),
37
(-17, -2, 6), (-9, 4, 10), (14, 11, 16), (13, -11, 18), (20, 20, 16), (7, -8, 15), (-16, 17, 16), (16, 9, 9), (-3, -13, 25),
38
(-20, -6, 17), (-10, -10, 12), (-7, 17, 25), (10, -10, 13), (10, 13, 20), (17, 6, 15), (18, -11, 14), (18, -12, 11), (-9, 11, 14),
39
(17, -15, 25), (-2, -8, 5), (5, 20, 20), (18, 20, 23), (-20, -16, 17), (-19, -2, 9), (-11, 19, 18), (17, 16, 12), (-5, -20, 15),
40
(-20, -13, 10), (-3, 5, 20), (-1, 13, 17), (-11, -9, 11)])
36
data = Series([(-1, -16, 12), (-12, 17, 11), (-4, 6, 5), (4, -20, 12), (13, -3, 21), (7, 14, 20), (-11, -2, 18), (19, 7, 18), (-10, -19, 15),
37
(-17, -2, 6), (-9, 4, 10), (14, 11, 16), (13, -11, 18), (20, 20, 16), (7, -8, 15), (-16, 17, 16), (16, 9, 9), (-3, -13, 25),
38
(-20, -6, 17), (-10, -10, 12), (-7, 17, 25), (10, -10, 13), (10, 13, 20), (17, 6, 15), (18, -11, 14), (18, -12, 11), (-9, 11, 14),
39
(17, -15, 25), (-2, -8, 5), (5, 20, 20), (18, 20, 23), (-20, -16, 17), (-19, -2, 9), (-11, 19, 18), (17, 16, 12), (-5, -20, 15),
40
(-20, -13, 10), (-3, 5, 20), (-1, 13, 17), (-11, -9, 11)])
41
41
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
42
42
cairoplot.scatter_plot ( 'scatter_2_variable_radius_series.png', data = data, width = 500, height = 500, border = 20,
43
43
axis = True, discrete = True, dots = 2, grid = True,
114
114
if test_vertical_bar_plot:
115
115
#Passing a dictionary
116
data = Serie({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
116
data = Series({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
117
117
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary_series.png', data, 400, 300, border = 20, grid = True, rounded_corners = True )
120
data = Serie({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
120
data = Series({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
121
121
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary_series.png', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
123
123
#Using default, rounded corners and 3D visualization
124
data = Serie([ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ])
124
data = Series([ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ])
125
125
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
126
126
series_labels = ["red", "orange", "yellow"]
127
127
cairoplot.vertical_bar_plot ( 'vbar_1_default_series.png', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
129
129
cairoplot.vertical_bar_plot ( 'vbar_3_3D_series.png', data, 400, 300, border = 20, series_labels = series_labels, grid = True, three_dimension = True, colors = colors )
131
131
#Mixing groups and columns
132
data = Serie([ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ])
132
data = Series([ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ])
133
133
cairoplot.vertical_bar_plot ( 'vbar_4_group_series.png', data, 400, 300, border = 20, grid = True )
135
135
#Using no labels, horizontal and vertical labels
136
data = Serie([[3,4], [4,8], [5,3], [9,1]])
136
data = Series([[3,4], [4,8], [5,3], [9,1]])
137
137
y_labels = [ "line1", "line2", "line3", "line4", "line5", "line6" ]
138
138
x_labels = [ "group1", "group2", "group3", "group4" ]
139
139
cairoplot.vertical_bar_plot ( 'vbar_5_no_labels_series.png', data, 600, 200, border = 20, grid = True )
142
142
cairoplot.vertical_bar_plot ( 'vbar_8_hy_labels_series.png', data, 600, 200, border = 20, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
145
data = Serie([[10*random.random()] for x in range(50)])
145
data = Series([[10*random.random()] for x in range(50)])
146
146
x_labels = ["large label name oh my god it's big" for x in data]
147
147
cairoplot.vertical_bar_plot ( 'vbar_9_large_series.png', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
150
data = Serie([ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ])
150
data = Series([ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ])
151
151
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
152
152
x_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
153
153
cairoplot.vertical_bar_plot ( 'vbar_10_stack_series.png', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
157
157
if test_horizontal_bar_plot:
158
158
#Passing a dictionary
159
data = Serie({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
159
data = Series({ 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] })
160
160
cairoplot.horizontal_bar_plot ( 'hbar_0_dictionary_series.png', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
162
162
#Using default, rounded corners and 3D visualization
163
data = Serie([ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ])
163
data = Series([ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ])
164
164
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
165
165
series_labels = ["red", "orange", "yellow"]
166
166
cairoplot.horizontal_bar_plot ( 'hbar_1_default_series.png', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
182
182
cairoplot.horizontal_bar_plot ( 'hbar_8_hy_labels_series.png', data, 600, 200, border = 20, series_labels = series_labels, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
185
data = Serie([[10*random.random()] for x in range(25)])
185
data = Series([[10*random.random()] for x in range(25)])
186
186
x_labels = ["large label name oh my god it's big" for x in data]
187
187
cairoplot.horizontal_bar_plot ( 'hbar_9_large_series.png', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
189
189
#Stack horizontal
190
data = Serie([ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ])
190
data = Series([ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ])
191
191
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
192
192
y_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
193
193
cairoplot.horizontal_bar_plot ( 'hbar_10_stack_series.png', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
220
220
if test_gantt_chart :
222
pieces = Serie([(0.5, 5.5), [(0, 4), (6, 8)], (5.5, 7), (7, 9)])
222
pieces = Series([(0.5, 5.5), [(0, 4), (6, 8)], (5.5, 7), (7, 9)])
223
223
x_labels = [ 'teste01', 'teste02', 'teste03', 'teste04']
224
224
y_labels = [ '0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009', '0010' ]
225
225
colors = [ (1.0, 0.0, 0.0), (1.0, 0.7, 0.0), (1.0, 1.0, 0.0), (0.0, 1.0, 0.0) ]
226
226
cairoplot.gantt_chart('gantt_1_default_series.png', pieces, 500, 350, x_labels, y_labels, colors)
229
data = Serie([[1,2,3,4,5,6,7,8,9,10,11,12,13,14]])
229
data = Series([[1,2,3,4,5,6,7,8,9,10,11,12,13,14]])
230
230
cairoplot.vertical_bar_plot ( 'bar_1_color_themes_series.png', data, 400, 300, border = 20, grid = True, colors="rainbow" )
232
data = Serie([[1,2,3,4,5,6,7,8,9,10,11,12,13,14]])
232
data = Series([[1,2,3,4,5,6,7,8,9,10,11,12,13,14]])
233
233
cairoplot.vertical_bar_plot ( 'bar_2_color_themes_series.png', data, 400, 300, background = "white light_gray", border = 20, grid = True, colors="rainbow" )
236
236
data.range = (0,10,0.1)
237
237
data.group_list = [ lambda x : 1, lambda y : y**2, lambda z : -z**2 ]
238
238
cairoplot.function_plot( 'function_color_themes_series.png', data, 400, 300, grid = True, series_colors = ["red", "orange", "yellow"], step = 0.1 )