views:

1629

answers:

4

I need to plot some data in various forms. Currently I'm using matplotlib and I'm fairly happy with the plots I'm able to produce.

This question is on how to plot the last one. The data is similar to the "distance table", like this (just bigger, my table is 128x128 and still have 3 or more number per element)

Now, my data is much better "structured" than a distance table (my data doesn't varies "randomly" like in a alphabetically sorted distance table), thus a 3D barchart, or maybe 3 of them, would be perfect. My understanding is that such a chart is missing in matplotlib.

I could use a (colored) Countor3d like these or something in 2d like imshow but it isn't really well representative of what the data is (the data has meaning just in my 128 points, there isn't anything between two points). And height of bars is more readable than color, IMO

Thus the questions:

  1. is it possible to create 3D barchart in matplotlib? It should be clear that I mean with a 2d domain not just 2D barchart with a "fake" 3D rendering for aesthetics purposes
  2. if the answer to the previous question is no, then is there some other library able to do that? I strongly prefer something python-based, but I'm ok with other linux-friendly possibilities
  3. if the answer to the previouw question is no, then do you have any suggestions in how to show that data? E.g. create a table with the values, superimposed to the imshow or other colored way?
+5  A: 

MyavaVi2 can make 3D barcharts (scroll down a bit). once you have mayavi/vtk/ets/etc installed it all works beautifully, but it can be some work getting it all installed. ubuntu has all of it packaged, but they're the only linux distro i know that does.

Autoplectic
Looks good an it is a piece of cake to install in Ubuntu, just sudo apt-get install mayavi2Unfortunately that example don't work:from enthought.mayavi.mlab import *ImportError: No module named mlabwhile (suggestion found online)from enthought.mayavi.tools.mlab import *works, but don't provide barchart()Suggestions?
Davide
what version of mayavi2 do you have? i believe mlab was overhauled for the 3.1.0 release, and that's what the documentation is covering.
Autoplectic
"mayavi2 -V" gives "MayaVi 2.0.2a1"
Davide
Autoplectic
No I cannot use it, but I'm marking your answer as accepted since you pointed out a very nice tool that I didn't know
Davide
What about easy_install mayavi?
dalloliogm
+6  A: 
Jouni K. Seppänen
Can the demo result be seen somewhere online? If not, can you run it on your local machine and edit your answer to show the source code and the resulting picture?
Davide
Thanks, I'm not accepting your answer since it doesn't work right now, but I upvoted it, and I look forward to see it working
Davide
A: 
Mark Harrison
+4  A: 

One more possibility is Gnuplot, which can draw some kind of pseudo 3D bar charts, and gnuplot.py allows interfacing to Gnuplot from Python. I have not tried it myself, though.

Jouni K. Seppänen
+1 Wow, gnuplot is coming from the back door in python :-) I used it a lot in the 90s... I'll have a look at it (but the pseudo 3D bar charts are ugly, compared to the newer tools...)
Davide