CairoPlot: the better way to plot amazing graphics

by LonelySpooky

logoHow many times have you had to plot some graphics but they didn’t look good enough for you?
Well, Cai­ro­Plot is an API writ­ten in Python by bra­zil­lian pro­gram­mers that uses Cairo to plot graphics with a more impres­sive look in an easy way.
By now, Cai­ro­Plot has just rele­a­sed its 1.1 ver­sion and can out­put ima­ges on the fol­lowing for­mats: PDF, PS, PNG and SVG.
After doing some tests, folks, I want to say I’m very impres­sed with this software’s poten­tial. Here, take a look:
With this sim­ple code:

1
2
3
4
5
6
import CairoPlot
import cairo
import math
#Function Plot
teste_data = [0, 1, 3, 8, 9, 0, 10, 10, 2, 1]
CairoPlot.dot_line_plot('teste', teste_data, 400, 300, axis=True)

I get this graphic:
graph
Or, take a look at how soft this line is:

1
2
data = lambda x : math.sin(0.1*x)*math.cos(x)
CairoPlot.function_plot('function_blog.png', data, 1000, 400, grid = True, h_bounds=(0,80), step = 0.1)

soft

Or how impres­sive your pre­sen­ta­tion will be with a donut graphic like that:

1
2
3
4
5
6
7
8
9
10
data = {"john" : 700, "mary" : 100, "philip" : 100 , "suzy" : 50, "yman" : 50}
background = cairo.LinearGradient(300, 0, 300, 400)
background.add_color_stop_rgb(0,0,0.4,0)
background.add_color_stop_rgb(1.0,0,0.1,0)
colors = [ (73.0/255, 233.0/255, 163.0/255),
           (80.0/255, 254.0/255, 228.0/255),
           (95.0/255, 255.0/255, 140.0/255),
           (75.0/255, 233.0/255, 73.0/255),
           (142.0/255, 255.0/255, 81.0/255) ]
CairoPlot.donut_plot("donut_blog.png", data, 600, 400, background = background, gradient = True, shadow = True, colors = colors, inner_radius = 0.3)

donut

How to download?

The first part is to down­load and ins­tall bazaar
# yum install bzr
Then, get Cai­ro­Plot
$ bzr branch lp:cairoplot/1.1

Do you want to help?

Con­tact Rodrigo Araujo at alf.rodrigo(at)gmail.com or visit http://linil.wordpress.com/ to get involved.

Popu­la­rity: 66% [?]

  • Share/Bookmark

Sem posts relacionados.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

{ 4 comments… read them below or add one }

1 jef 25 de setembro de 2008 às 1:41

Can you com­pare and cons­trast this with mat­plo­tlib? mat­plo­tlib sup­ports a cairo bac­kend for plot­ting along with seve­ral others.

What do I gain by using Cai­ro­plot ins­tead of wor­king to extend matplotlib/scipy/numpy?

–jef

Responder

2 Rodrigo Araújo 25 de setembro de 2008 às 9:29

Hi there Jef, I’m one of the authors of Cai­ro­Plot.
So, as I see it, the main advan­tage of Cai­ro­Plot over Mat­Plo­tLibe is the look.
The out­put for every and each Cai­ro­Plot func­tion was thought to be eye cat­ching in a way to impress the audi­ence, making it very for pre­sen­ta­ti­ons and web­si­tes.
I beli­eve Mat­Plo­tLib is still the best option for sci­en­ti­fic pur­po­ses (although I’ve been deve­lo­ping a Gtk Wid­get which will let PyGtk users plot func­ti­ons in real time using Cai­ro­Plot). But we are wor­king on other out­puts, so we can cover other areas of knowledge.

Thanks for the interest.

Responder

3 chris 25 de setembro de 2008 às 18:57

Two quick ques­ti­ons … since this was pos­ted on pla­net fedora … any chance of making a .rpm for 1.1? Also can this be used with R?

Responder

4 Henrique "LonelySpooky" Junior 25 de setembro de 2008 às 22:42

Hi, Crtis.
We’re tal­king about an RPM for fedora and, maybe, it’ll not be so hard to link with R.

Responder

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">

Previous post:

Next post: