ok, so making graphs in excel for physics papers is kinda boring, so I got the idea that maybe I could make a script that would make a cool graph in blender! (and i needed the scripting practice anyway;)) so here 'tis:
edit: latest version (.tar.gz)
windows users: alot of free programs can unzip gzipped tarbells, izark is a good one (just google it)

and what it looks like streight from the script (only added a world and lights, the script does materials:
and the ui (image edited, left is on default, right is ‘rounded’):
a little explanation:

Cycle: this menu has four choices, use mat 1, use mat 2, use mat 3, and cycle. 1,2 and 3 will make all the bars the same color (either one, two or three), cycle will make it like the render above.
Color Pickers: below cycle there are three color pickers, these control the color of material one, two, and three.
Data Box: enter data in this box, it should be a list (i.e. [1,3,5,2,3,1])
ScaleDn: this number box (in center, fuzzed) will scale the bars up or down, it’s kinda temperamental… I wouldn’t use it…
Reflect: Whether or not the backdrop is reflective. (turns raymirr on and up to .25)
Shade?: whether or not to shade the bars. (off = shadeless setting in materials)
Backdrop col: This color picker chooses the backdrop color.

Exit and Graph: these should be fairly obvious.

tell me what you think.

oh, and special thanks to Cambo and R3gis, I tore apart their scripts learning what I needed… (yay for docstrings!)

also: plans for next version: add labels and more options. I’d also like a duplicated object option where an object, like susanne, would be duplicated up then the bars would be used with boolian modifyers (intersect) to make monkey graphs…

Cool - if there’s anything that’ll make a graph look cool, it’s a bit of ambient occlusion :smiley:

Haven’t tested it myself, but will soon.

When I run it I get :

Syntax error :
 File "", line 222
   data = enter data in this format: [1,2,3,4]

I commented out the Blender.Text.unlink(txt) line so I could see the “” file, and line 222 in that script is :

data = enter data in this format: [1,2,3,4]

Looks like the quoting got lost.

So I tried changing that line (in to :

data = "enter data in this format: [1,2,3,4]"

I then tried to run and get :

Traceback (most recent call last):
  File "", line 224, in ?
  File "", line 218, in main
  File "", line 171, in barGraph
  File "", line 131, in barDrawCube
ValueError: expected sequence triplet of floats

At which point, I’m not going to go “debugging” any further :smiley:

Are you sure you posted the code that worked, or did you make “one last change” and post it without testing it ? :rolleyes:


edit: see below

argh! i just realised it’s the way you entered your data! you have to actually type the brackets:


not just


that way, ‘’ will say

data = [1,3,4,2,5,2]

hence, creating a list

I’ll remove it in the next version though, so you can simply type the numbers seperated by commas, maybe I’ll also change it to a sequence instead of a list too, so you could type

last year:52, this year:45

for the labeling system…

oh, btw, you prolly already know this, but you have to replace the string “type the data in this format [1,2,3,4]” in the gui. just click on the box, highlight all, backspace, type your own.

edit: I also have plans to make a line craph function (3d and 2d), and a scatter point function (verts with halo on, maybe an algorithm to find a median line graph thingy…

Here’s what I’d like the script to eventually be able to do (it should be like this directly from the script w/o tweaking:

Bar graph is almost done, just add a labeling function
next, comes single line graphs.
then, multiple line graphs

I actually didn’t enter anything, I just pressed the Graph button.

If you change :

data = Create("enter data in this format: [1,2,3,4]")


data = Create("[1,2,3,4]")


data = String("",EVENT_NOEVENT,10,51,400,20,data.val,399,"enter data in the format [1,2,3,4]")


data = String("Enter data in the format:",EVENT_NOEVENT,10,51,400,20,data.val,399,"[1,2,3,4]")

…then pressing Graph works

Even without those modifications though, all the cubes are being drawn twice, the second time all the cubes are black :confused:


Cool script! I may have to learn some python soon…

I’ll make your changes to v2.0, the black cubes are intentional. If you look at the first post closely you’ll see that there’s a nifty (at least I think so) little black line along all the edges, I think it makes it look better. That’s the second cube, set to wire. In v2.0 i’ll put a toggle button to add or remove these.

thanks for your help and comments…

as for v2.0, I’m going to make the functions modular and seperate from the gui. (way easier to do the gui, for me.) It should be interesting.

@dgebel: It’s not as hard as it lools, just do some python tutorials (i like the one that comes with IDLE) then download the api referance at, then think up a script and make it. (it was easier for me to learn the api from the docs as i went, instead of memorizing them ahead of time)

edit: I put the edges in because I was originally aiming at using the ‘shadeless’ option, try it: turn of ‘shade’ and ‘reflect’, graph, and render… you’ll see what I mean.

update: link above changed:
-now modular, I will make more modules soon
-fixed input field, no longer requires you to add brackets
-changed values so you can hit ‘graph’ and get results w/o changed fields
-added ‘outline’ toggle, so you can turn off the wire outline
-rearranged ui
-a little cleanup.

I have not tried your script but your results look very cool. I will give it a try later I have no need of making graphs but I am interested in looking at the script. I try some scripting every now and then You inspired me to try some more thanks.

to tell you the truth, I don’t really need to graph anything anymore either, I’m doing this for fun. More updates tomarrow, (hopefully a line graph function too).

what do you guys think about the gui? I’m trying my best to keep it self-explanitory and neat…

nice gui. try adding more colours or explaining others what those colored sqares are for.


the colored squares are color pickers, click on them to change the colors of the graph… I think I will add more materials though…

This script does not work.

It references some library called “graph”.

Anyone try this script successfully?

Nice idea: I’ll have a look at this sooner or later !

the link to the file is broken… can anyone post a copy please?

As I said, it does not work.


hi jessethemid,
your link from first post doesn’t work, i found the script on BlenderWiki (thanks Meta*)
I’ve tested the script: the version 2.42 - 06.10.2006, works well with blender 2.48 winXP with/without Python installed.
Nice idea, thanks for sharing!
Tiny bug: there are faces in each bar with wrong normals.

I’d suggest to rethink the concept: I see no reason for existing as extern module. I don’t like the method for calling write() through generating text object “”. The script will not work if there is a text “” in blend file already.

More flexible color assignment (any number of colors) would be great.


edit: just noticed, it is a quite old script version, no more updated since 2006