rodrigoaraujo01/cairoplot forked from mrooney/cairoplot

Subversion checkout URL

You can clone with HTTPS or Subversion.

Python Perl
#4

This branch is 26 commits ahead, 1 commit behind mrooney:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

 Failed to load latest commit information. cairoplot demo-graphs docs tests trunk .gitignore LICENSE Makefile README.md TODO.md requirements.txt setup.py

CairoPlot

CairoPlot is a pure Python plotting library which uses Cairo C/Python API to create astonishing charts in a easy and intuitive way, perfect fot for presentations, websites and papers.

It was recognized by the great aesthetics originally conceived by Rodrigo Araujo.

Official site: CairoPlot

Some Plotting Demos

Functions

``````data = [ lambda x : 1, lambda y : y**2, lambda z : -z**2 ]
colors = ['red', 'orange', 'yellow']
cairoplot.function_plot( 'function.png', data, 800, 600, grid = True, step = 0.1 )
``````

Discrete functions

``````data = lambda x: [1,2,3,4,5][x]
x_labels = ['4', '3', '2', '1', '0']
cairoplot.function_plot('discrete.png', data, 800, 600,
discrete = True, dots = True, grid = True,
x_labels = x_labels, x_bounds=(0,4), step = 1)
``````

Scatter Plot

``````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), (-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), (-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), (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), (-20, -13, 10), (-3, 5, 20), (-1, 13, 17), (-11, -9, 11)]
colors = [ (0,0,0,0.25), (1,0,0,0.75) ]
cairoplot.scatter_plot ('scatter.png', data = data, width = 800, height = 600,
border = 20, axis = True, discrete = True, dots = 2,
grid = True, x_title = 'x axis', y_title = 'y axis',
circle_colors = colors )
``````

Error bars

``````t = [x*0.1 for x in range(0,40)]
f = [math.exp(x) for x in t]
g = [10*math.cos(x) for x in t]
h = [10*math.sin(x) for x in t]
erx = [0.1*random.random() for x in t]
ery = [5*random.random() for x in t]
data = {'exp' : [t,f], 'cos' : [t,g], 'sin' : [t,h]}
series_colors = [ (1,0,0), (0,0,0), (0,0,1) ]
cairoplot.scatter_plot ('error_bars.png', data = data,
errorx = [erx,erx], errory = [ery,ery],
width = 800, height = 600, border = 20,
axis = True, discrete = False, dots = 5, grid = True,
x_title = 't', y_title = 'f(t) g(t)',
series_legend=True, series_colors = series_colors)
``````

Donut Plot

``````background = cairo.LinearGradient(300, 0, 300, 400)
data = {'john' : 700, 'mary' : 100, 'philip' : 100 , 'suzy' : 50, 'yman' : 50}
cairoplot.donut_plot('donut.png', data, 800, 600, background = background,
``````

Pie Plot

``````background = cairo.LinearGradient(300, 0, 300, 400)
data = {'orcs' : 100, 'goblins' : 230, 'elves' : 50 , 'demons' : 43,
'humans' : 332}
cairoplot.pie_plot('pie.png', data, 800, 600, background = background,
``````

Gantt Chart

``````pieces = [(0.5, 5.5), [(0, 4), (6, 8)], (5.5, 7), (7, 9)]
x_labels = ['teste01', 'teste02', 'teste03', 'teste04']
y_labels = ['0001', '0002', '0003', '0004', '0005',
'0006', '0007', '0008', '0009', '0010']
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)]
cairoplot.gantt_chart('gantt.png', pieces, 800, 600, x_labels, y_labels, colors)
``````

Horizontal Bars

``````data = [27, 10, 18, 5, 1, 22]
cairoplot.horizontal_bar_plot('horizontal.png', data, 800, 600, border = 20,
display_values = True, grid = True, rounded_corners = True)
``````

Horizontal Bars Stacked

``````data = [[6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11]]
colors = [(1,0.2,0), (1,0.7,0), (1,1,0)]
y_labels = ['teste1', 'teste2', 'testegrande3', 'testegrande4']
cairoplot.horizontal_bar_plot('stack.png', data, 800, 600, border = 20,
display_values = True, grid = True, rounded_corners = True,
stack = True, y_labels = y_labels, colors = colors)
``````

Vertical Bars

``````data = [[0, 3, 11], [8, 9, 21], [13, 10, 9], [2, 30, 8]]
colors = [(1,0.2,0), (1,0.7,0), (1,1,0)]
series_labels = ['red', 'orange', 'yellow']
cairoplot.vertical_bar_plot('vertical.png', data, 800, 600, border = 20,
series_labels = series_labels, display_values = True, grid = True,
rounded_corners = True, colors = colors)
``````

Vertical Bars Grouped

``````data = [[3,4], [4,8], [5,3], [9,1]]
y_labels = ['line1', 'line2', 'line3', 'line4', 'line5', 'line6']
x_labels = ['group1', 'group2', 'group3', 'group4']
cairoplot.vertical_bar_plot('groups.png', data, 800, 600, border = 20,
display_values = True, grid = True,
x_labels = x_labels, y_labels = y_labels )
``````