1
import cairo, math, random
7
10
test_vertical_bar_plot = 1
8
11
test_horizontal_bar_plot = 1
11
test_dot_line_plot = 0
12
test_function_plot = 0
17
if test_vertical_bar_plot:
19
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
20
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary', data, 400, 300, border = 20, grid = True, rounded_corners = True )
23
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
24
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
26
#Using default, rounded corners and 3D visualization
27
data = [ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ]
28
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
29
series_labels = ["red", "orange", "yellow"]
30
cairoplot.vertical_bar_plot ( 'vbar_1_default', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
31
cairoplot.vertical_bar_plot ( 'vbar_2_rounded', data, 400, 300, border = 20, series_labels = series_labels, display_values = True, grid = True, rounded_corners = True, colors = colors )
32
cairoplot.vertical_bar_plot ( 'vbar_3_3D', data, 400, 300, border = 20, series_labels = series_labels, grid = True, three_dimension = True, colors = colors )
34
#Mixing groups and columns
35
data = [ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ]
36
cairoplot.vertical_bar_plot ( 'vbar_4_group', data, 400, 300, border = 20, grid = True )
38
#Using no labels, horizontal and vertical labels
39
data = [[3,4], [4,8], [5,3], [9,1]]
40
y_labels = [ "line1", "line2", "line3", "line4", "line5", "line6" ]
41
x_labels = [ "group1", "group2", "group3", "group4" ]
42
cairoplot.vertical_bar_plot ( 'vbar_5_no_labels', data, 600, 200, border = 20, grid = True )
43
cairoplot.vertical_bar_plot ( 'vbar_6_x_labels', data, 600, 200, border = 20, grid = True, x_labels = x_labels )
44
cairoplot.vertical_bar_plot ( 'vbar_7_y_labels', data, 600, 200, border = 20, grid = True, y_labels = y_labels )
45
cairoplot.vertical_bar_plot ( 'vbar_8_hy_labels', data, 600, 200, border = 20, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
48
data = [[10*random.random()] for x in range(50)]
49
x_labels = ["large label name oh my god it's big" for x in data]
50
cairoplot.vertical_bar_plot ( 'vbar_9_large', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
53
data = [ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ]
54
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
55
x_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
56
cairoplot.vertical_bar_plot ( 'vbar_10_stack', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
57
x_labels = x_labels, colors = colors )
60
if test_horizontal_bar_plot:
62
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
63
cairoplot.horizontal_bar_plot ( 'hbar_0_dictionary', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
65
#Using default, rounded corners and 3D visualization
66
data = [ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ]
67
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
68
series_labels = ["red", "orange", "yellow"]
69
cairoplot.horizontal_bar_plot ( 'hbar_1_default', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
70
cairoplot.horizontal_bar_plot ( 'hbar_2_rounded', data, 400, 300, border = 20, series_labels = series_labels, display_values = True, grid = True, rounded_corners = True, colors = colors )
73
#Mixing groups and columns
74
data = [ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ]
75
cairoplot.horizontal_bar_plot ( 'hbar_4_group', data, 400, 300, border = 20, grid = True )
77
#Using no labels, horizontal and vertical labels
78
series_labels = ["data11", "data22"]
79
data = [[3,4], [4,8], [5,3], [9,1]]
80
x_labels = [ "line1", "line2", "line3", "line4", "line5", "line6" ]
81
y_labels = [ "group1", "group2", "group3", "group4" ]
82
cairoplot.horizontal_bar_plot ( 'hbar_5_no_labels', data, 600, 200, border = 20, series_labels = series_labels, grid = True )
83
cairoplot.horizontal_bar_plot ( 'hbar_6_x_labels', data, 600, 200, border = 20, series_labels = series_labels, grid = True, x_labels = x_labels )
84
cairoplot.horizontal_bar_plot ( 'hbar_7_y_labels', data, 600, 200, border = 20, series_labels = series_labels, grid = True, y_labels = y_labels )
85
cairoplot.horizontal_bar_plot ( 'hbar_8_hy_labels', data, 600, 200, border = 20, series_labels = series_labels, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
88
data = [[10*random.random()] for x in range(25)]
89
x_labels = ["large label name oh my god it's big" for x in data]
90
cairoplot.horizontal_bar_plot ( 'hbar_9_large', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
93
data = [ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ]
94
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
95
y_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
96
cairoplot.horizontal_bar_plot ( 'hbar_10_stack', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
97
y_labels = y_labels, colors = colors )
100
#Define a new backgrond
101
background = cairo.LinearGradient(300, 0, 300, 400)
102
background.add_color_stop_rgb(0,0.4,0.4,0.4)
103
background.add_color_stop_rgb(1.0,0.1,0.1,0.1)
105
data = {"john" : 700, "mary" : 100, "philip" : 100 , "suzy" : 50, "yman" : 50}
106
#Default plot, gradient and shadow, different background
107
cairoplot.donut_plot( "donut_1_default", data, 600, 400, inner_radius = 0.3 )
108
cairoplot.donut_plot( "donut_2_gradient_shadow", data, 600, 400, gradient = True, shadow = True, inner_radius = 0.3 )
109
cairoplot.donut_plot( "donut_3_background", data, 600, 400, background = background, gradient = True, shadow = True, inner_radius = 0.3 )
22
data = [(50,10),(15,55),(10,70),(15,85),(30,90),(40,85),(50,70),(60,85),(70,90),(85,85),(90,70),(85,55),(50,10)]
23
cairoplot.scatter_plot ( 'scatter_0.svg', data = data, width = 500, height = 500, border = 20, axis = True, dots = 3, grid = True,
24
x_bounds=[0,100], y_bounds=[0,100], series_colors = [(1,0,0)] )
27
data = [ (-2,10), (0,0), (0,15), (1,5), (2,0), (3,-10), (3,5) ]
28
cairoplot.scatter_plot ( 'scatter_1_default.svg', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
30
#lists of coordinates x,y
31
data = [[1,2,3,4,5],[1,1,1,1,1]]
32
cairoplot.scatter_plot ( 'scatter_2_lists.svg', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
34
#lists of coordinates x,y,z
35
data = [[0.5,1,2,3,4,5],[0.5,1,1,1,1,1],[10,6,10,20,10,6]]
36
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
37
cairoplot.scatter_plot ( 'scatter_3_lists.svg', data = data, width = 500, height = 500, border = 20, axis = True, discrete = True,
38
grid = True, circle_colors = colors )
40
data = [(-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),
41
(-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),
42
(-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),
43
(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),
44
(-20, -13, 10), (-3, 5, 20), (-1, 13, 17), (-11, -9, 11)]
45
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
46
cairoplot.scatter_plot ( 'scatter_2_variable_radius.svg', data = data, width = 500, height = 500, border = 20,
47
axis = True, discrete = True, dots = 2, grid = True,
48
x_title = "x axis", y_title = "y axis", circle_colors = colors )
50
#Scatter x DotLine error bars
51
t = [x*0.1 for x in range(0,40)]
52
f = [math.exp(x) for x in t]
53
g = [10*math.cos(x) for x in t]
54
h = [10*math.sin(x) for x in t]
55
erx = [0.1*random.random() for x in t]
56
ery = [5*random.random() for x in t]
57
data = {"exp" : [t,f], "cos" : [t,g], "sin" : [t,h]}
58
series_colors = [ (1,0,0), (0,0,0), (0,0,1) ]
59
cairoplot.scatter_plot ( 'cross_r_exponential.svg', data = data, errorx = [erx,erx], errory = [ery,ery], width = 800, height = 600, border = 20,
60
axis = True, discrete = False, dots = 5, grid = True,
61
x_title = "t", y_title = "f(t) g(t)", series_legend=True, series_colors = series_colors )
111
64
if test_dot_line_plot:
113
66
data = [ 0, 1, 3.5, 8.5, 9, 0, 10, 10, 2, 1 ]
114
cairoplot.dot_line_plot( "dot_line_1_default", data, 400, 300, border = 50, axis = True, grid = True,
67
cairoplot.dot_line_plot( "dot_line_1_default.svg", data, 400, 300, border = 50, axis = True, grid = True,
115
68
x_title = "x axis", y_title = "y axis" )
118
71
data = { "john" : [-5, -2, 0, 1, 3], "mary" : [0, 0, 3, 5, 2], "philip" : [-2, -3, -4, 2, 1] }
119
72
x_labels = [ "jan/2008", "feb/2008", "mar/2008", "apr/2008", "may/2008" ]
120
73
y_labels = [ "very low", "low", "medium", "high", "very high" ]
121
cairoplot.dot_line_plot( "dot_line_2_dictionary_labels", data, 400, 300, x_labels = x_labels,
74
cairoplot.dot_line_plot( "dot_line_2_dictionary_labels.svg", data, 400, 300, x_labels = x_labels,
122
75
y_labels = y_labels, axis = True, grid = True,
123
76
x_title = "x axis", y_title = "y axis", series_legend=True )
126
79
data = { "john" : [10, 10, 10, 10, 30], "mary" : [0, 0, 3, 5, 15], "philip" : [13, 32, 11, 25, 2] }
127
80
x_labels = [ "jan/2008", "feb/2008", "mar/2008", "apr/2008", "may/2008" ]
128
cairoplot.dot_line_plot( 'dot_line_3_series_legend', data, 400, 300, x_labels = x_labels,
81
cairoplot.dot_line_plot( 'dot_line_3_series_legend.svg', data, 400, 300, x_labels = x_labels,
129
82
axis = True, grid = True, series_legend = True )
131
84
if test_function_plot :
133
86
data = lambda x : x**2
134
cairoplot.function_plot( 'function_1_default', data, 400, 300, grid = True, x_bounds=(-10,10), step = 0.1 )
87
cairoplot.function_plot( 'function_1_default.svg', data, 400, 300, grid = True, x_bounds=(-10,10), step = 0.1 )
137
90
data = lambda x : math.sin(0.1*x)*math.cos(x)
138
cairoplot.function_plot( 'function_2_discrete', data, 800, 300, discrete = True, dots = True, grid = True, x_bounds=(0,80),
91
cairoplot.function_plot( 'function_2_discrete.svg', data, 800, 300, discrete = True, dots = True, grid = True, x_bounds=(0,80),
139
92
x_title = "t (s)", y_title = "sin(0.1*x)*cos(x)")
142
95
data = lambda x : [1,2,3,4,5][x]
143
96
x_labels = [ "4", "3", "2", "1", "0" ]
144
cairoplot.function_plot( 'function_3_labels', data, 400, 300, discrete = True, dots = True, grid = True, x_labels = x_labels, x_bounds=(0,4), step = 1 )
97
cairoplot.function_plot( 'function_3_labels.svg', data, 400, 300, discrete = True, dots = True, grid = True, x_labels = x_labels, x_bounds=(0,4), step = 1 )
146
99
#Multiple functions
147
100
data = [ lambda x : 1, lambda y : y**2, lambda z : -z**2 ]
148
101
colors = [ (1.0, 0.0, 0.0 ), ( 0.0, 1.0, 0.0 ), ( 0.0, 0.0, 1.0 ) ]
149
cairoplot.function_plot( 'function_4_multi_functions', data, 400, 300, grid = True, series_colors = colors, step = 0.1 )
102
cairoplot.function_plot( 'function_4_multi_functions.svg', data, 400, 300, grid = True, series_colors = colors, step = 0.1 )
155
108
gaussian = lambda x : a*math.exp(-(x-b)*(x-b)/(2*c*c))
156
cairoplot.function_plot( 'function_5_gaussian', data, 400, 300, grid = True, x_bounds = (-10,10), step = 0.1 )
158
if test_gantt_chart :
160
pieces = [ (0.5,5.5) , [(0,4),(6,8)] , (5.5,7) , (7,9)]
161
x_labels = [ 'teste01', 'teste02', 'teste03', 'teste04']
162
y_labels = [ '0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009', '0010' ]
163
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) ]
164
cairoplot.gantt_chart('gantt_1_default', pieces, 500, 350, x_labels, y_labels, colors)
109
cairoplot.function_plot( 'function_5_gaussian.svg', data, 400, 300, grid = True, x_bounds = (-10,10), step = 0.1 )
112
data = {'linear':lambda x : x*2, 'quadratic':lambda x:x**2, 'cubic':lambda x:(x**3)/2}
113
cairoplot.function_plot( 'function_6_dict.svg', data, 400, 300, grid = True, x_bounds=(-5,5), step = 0.1 )
116
if test_vertical_bar_plot:
117
#Passing a dictionary
118
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
119
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary.svg', data, 400, 300, border = 20, grid = True, rounded_corners = True )
122
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
123
cairoplot.vertical_bar_plot ( 'vbar_0_dictionary.svg', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
125
#Using default, rounded corners and 3D visualization
126
data = [ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ]
127
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
128
series_labels = ["red", "orange", "yellow"]
129
cairoplot.vertical_bar_plot ( 'vbar_1_default.svg', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
130
cairoplot.vertical_bar_plot ( 'vbar_2_rounded.svg', data, 400, 300, border = 20, series_labels = series_labels, display_values = True, grid = True, rounded_corners = True, colors = colors )
131
cairoplot.vertical_bar_plot ( 'vbar_3_3D.svg', data, 400, 300, border = 20, series_labels = series_labels, grid = True, three_dimension = True, colors = colors )
133
#Mixing groups and columns
134
data = [ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ]
135
cairoplot.vertical_bar_plot ( 'vbar_4_group.svg', data, 400, 300, border = 20, grid = True )
137
#Using no labels, horizontal and vertical labels
138
data = [[3,4], [4,8], [5,3], [9,1]]
139
y_labels = [ "line1", "line2", "line3", "line4", "line5", "line6" ]
140
x_labels = [ "group1", "group2", "group3", "group4" ]
141
cairoplot.vertical_bar_plot ( 'vbar_5_no_labels.svg', data, 600, 200, border = 20, grid = True )
142
cairoplot.vertical_bar_plot ( 'vbar_6_x_labels.svg', data, 600, 200, border = 20, grid = True, x_labels = x_labels )
143
cairoplot.vertical_bar_plot ( 'vbar_7_y_labels.svg', data, 600, 200, border = 20, grid = True, y_labels = y_labels )
144
cairoplot.vertical_bar_plot ( 'vbar_8_hy_labels.svg', data, 600, 200, border = 20, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
147
data = [[10*random.random()] for x in range(50)]
148
x_labels = ["large label name oh my god it's big" for x in data]
149
cairoplot.vertical_bar_plot ( 'vbar_9_large.svg', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
152
data = [ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ]
153
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
154
x_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
155
cairoplot.vertical_bar_plot ( 'vbar_10_stack.svg', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
156
x_labels = x_labels, colors = colors )
159
if test_horizontal_bar_plot:
160
#Passing a dictionary
161
data = { 'teste00' : [27], 'teste01' : [10], 'teste02' : [18], 'teste03' : [5], 'teste04' : [1], 'teste05' : [22] }
162
cairoplot.horizontal_bar_plot ( 'hbar_0_dictionary.svg', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True )
164
#Using default, rounded corners and 3D visualization
165
data = [ [0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8] ]
166
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
167
series_labels = ["red", "orange", "yellow"]
168
cairoplot.horizontal_bar_plot ( 'hbar_1_default.svg', data, 400, 300, border = 20, grid = True, rounded_corners = False, colors = "yellow_orange_red" )
169
cairoplot.horizontal_bar_plot ( 'hbar_2_rounded.svg', data, 400, 300, border = 20, series_labels = series_labels, display_values = True, grid = True, rounded_corners = True, colors = colors )
172
#Mixing groups and columns
173
data = [ [1], [2], [3,4], [4], [5], [6], [7], [8], [9], [10] ]
174
cairoplot.horizontal_bar_plot ( 'hbar_4_group.svg', data, 400, 300, border = 20, grid = True )
176
#Using no labels, horizontal and vertical labels
177
series_labels = ["data11", "data22"]
178
data = [[3,4], [4,8], [5,3], [9,1]]
179
x_labels = [ "line1", "line2", "line3", "line4", "line5", "line6" ]
180
y_labels = [ "group1", "group2", "group3", "group4" ]
181
cairoplot.horizontal_bar_plot ( 'hbar_5_no_labels.svg', data, 600, 200, border = 20, series_labels = series_labels, grid = True )
182
cairoplot.horizontal_bar_plot ( 'hbar_6_x_labels.svg', data, 600, 200, border = 20, series_labels = series_labels, grid = True, x_labels = x_labels )
183
cairoplot.horizontal_bar_plot ( 'hbar_7_y_labels.svg', data, 600, 200, border = 20, series_labels = series_labels, grid = True, y_labels = y_labels )
184
cairoplot.horizontal_bar_plot ( 'hbar_8_hy_labels.svg', data, 600, 200, border = 20, series_labels = series_labels, display_values = True, grid = True, x_labels = x_labels, y_labels = y_labels )
187
data = [[10*random.random()] for x in range(25)]
188
x_labels = ["large label name oh my god it's big" for x in data]
189
cairoplot.horizontal_bar_plot ( 'hbar_9_large.svg', data, 1000, 800, border = 20, grid = True, rounded_corners = True, x_labels = x_labels )
192
data = [ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ]
193
colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ]
194
y_labels = ["teste1", "teste2", "testegrande3", "testegrande4"]
195
cairoplot.horizontal_bar_plot ( 'hbar_10_stack.svg', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True,
196
y_labels = y_labels, colors = colors )
167
198
if test_pie_plot :
168
199
#Define a new backgrond
174
205
data = {"orcs" : 100, "goblins" : 230, "elves" : 50 , "demons" : 43, "humans" : 332}
175
cairoplot.pie_plot( "pie_1_default", data, 600, 400 )
176
cairoplot.pie_plot( "pie_2_gradient_shadow", data, 600, 400, gradient = True, shadow = True )
177
cairoplot.pie_plot( "pie_3_background", data, 600, 400, background = background, gradient = True, shadow = True )
179
if test_scatter_plot:
181
data = [ (-2,10), (0,0), (0,15), (1,5), (2,0), (3,-10), (3,5) ]
182
cairoplot.scatter_plot ( 'scatter_1_default', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
184
#lists of coordinates x,y
185
data = [[1,2,3,4,5],[1,1,1,1,1]]
186
cairoplot.scatter_plot ( 'scatter_2_lists', data = data, width = 500, height = 500, border = 20, axis = True, grid = True )
188
#lists of coordinates x,y,z
189
data = [[0.5,1,2,3,4,5],[0.5,1,1,1,1,1],[10,6,10,20,10,6]]
190
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
191
cairoplot.scatter_plot ( 'scatter_3_lists', data = data, width = 500, height = 500, border = 20, axis = True, discrete = True,
192
grid = True, circle_colors = colors )
194
data = [(-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),
195
(-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),
196
(-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),
197
(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),
198
(-20, -13, 10), (-3, 5, 20), (-1, 13, 17), (-11, -9, 11)]
199
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
200
cairoplot.scatter_plot ( 'scatter_2_variable_radius', data = data, width = 500, height = 500, border = 20,
201
axis = True, discrete = True, dots = 2, grid = True,
202
x_title = "x axis", y_title = "y axis", circle_colors = colors )
204
#Scatter x DotLine error bars
205
t = [x*0.1 for x in range(0,40)]
206
f = [math.exp(x) for x in t]
207
g = [10*math.cos(x) for x in t]
208
h = [10*math.sin(x) for x in t]
209
erx = [0.1*random.random() for x in t]
210
ery = [5*random.random() for x in t]
211
data = {"exp" : [t,f], "cos" : [t,g], "sin" : [t,h]}
212
series_colors = [ (1,0,0), (0,0,0), (0,0,1) ]
213
cairoplot.scatter_plot ( 'cross_r_exponential', data = data, errorx = [erx,erx], errory = [ery,ery], width = 800, height = 600, border = 20,
214
axis = True, discrete = False, dots = 5, grid = True,
215
x_title = "t", y_title = "f(t) g(t)", series_legend=True, series_colors = series_colors )
206
cairoplot.pie_plot( "pie_1_default.svg", data, 600, 400 )
207
cairoplot.pie_plot( "pie_2_gradient_shadow.svg", data, 600, 400, gradient = True, shadow = True )
208
cairoplot.pie_plot( "pie_3_background.svg", data, 600, 400, background = background, gradient = True, shadow = True )
211
#Define a new backgrond
212
background = cairo.LinearGradient(300, 0, 300, 400)
213
background.add_color_stop_rgb(0,0.4,0.4,0.4)
214
background.add_color_stop_rgb(1.0,0.1,0.1,0.1)
216
data = {"john" : 700, "mary" : 100, "philip" : 100 , "suzy" : 50, "yman" : 50}
217
#Default plot, gradient and shadow, different background
218
cairoplot.donut_plot( "donut_1_default.svg", data, 600, 400, inner_radius = 0.3 )
219
cairoplot.donut_plot( "donut_2_gradient_shadow.svg", data, 600, 400, gradient = True, shadow = True, inner_radius = 0.3 )
220
cairoplot.donut_plot( "donut_3_background.svg", data, 600, 400, background = background, gradient = True, shadow = True, inner_radius = 0.3 )
222
if test_gantt_chart :
224
pieces = [(0.5, 5.5), [(0, 4), (6, 8)], (5.5, 7), (7, 9)]
225
x_labels = [ 'teste01', 'teste02', 'teste03', 'teste04']
226
y_labels = [ '0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009', '0010' ]
227
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) ]
228
cairoplot.gantt_chart('gantt_1_default.svg', pieces, 500, 350, x_labels, y_labels, colors)
219
232
data = [[1,2,3,4,5,6,7,8,9,10,11,12,13,14]]
220
cairoplot.vertical_bar_plot ( 'bar_color_themes', data, 400, 300, border = 20, grid = True, colors="rainbow" )
233
cairoplot.vertical_bar_plot ( 'bar_1_color_themes.svg', data, 400, 300, border = 20, grid = True, colors="rainbow" )
222
235
data = [[1,2,3,4,5,6,7,8,9,10,11,12,13,14]]
223
cairoplot.vertical_bar_plot ( 'bar_color_themes', data, 400, 300, background = "white light_gray", border = 20, grid = True, colors="rainbow" )
236
cairoplot.vertical_bar_plot ( 'bar_2_color_themes.svg', data, 400, 300, background = "black light_gray", border = 20, grid = True, colors="rainbow" )
225
238
data = [ lambda x : 1, lambda y : y**2, lambda z : -z**2 ]
226
cairoplot.function_plot( 'function_color_themes', data, 400, 300, grid = True, series_colors = ["red", "orange", "yellow"], step = 0.1 )
239
cairoplot.function_plot( 'function_color_themes.svg', data, 400, 300, grid = True, series_colors = ["red", "orange", "yellow"], step = 0.1 )
228
241
#Scatter x DotLine
229
242
t = [x*0.1 for x in range(0,40)]