As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
What are the available libraries for creating pretty charts and graphs in a Python application?
I'm the one supporting CairoPlot and I'm very proud it came up here.
Surely matplotlib is great, but I believe CairoPlot is better looking.
So, for presentations and websites, it's a very good choice.
Today I released version 1.1. If interested, check it out at CairoPlot v1.1
EDIT: After a long and cold winter, CairoPlot is being developed again. Check out the new version on GitHub.
For interactive work, Matplotlib is the mature standard. It provides an OO-style API as well as a Matlab-style interactive API.
Chaco is a more modern plotting library from the folks at Enthought. It uses Enthought's Kiva vector drawing library and currently works only with Wx and Qt with OpenGL on the way (Matplotlib has backends for Tk, Qt, Wx, Cocoa, and many image types such as PDF, EPS, PNG, etc.). The main advantages of Chaco are its speed relative to Matplotlib and its integration with Enthought's Traits API for interactive applications.
You can also use pygooglechart, which uses the Google Chart API. This isn't something you'd always want to use, but if you want a small number of good, simple, charts, and are always online, and especially if you're displaying in a browser anyway, it's a good choice.
You didn't mention what output format you need but reportlab is good at creating charts both in pdf and bitmap (e.g. png) format.
Here is a simple example of a barchart in png and pdf format:
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
d = Drawing(300, 200)
chart = VerticalBarChart()
chart.width = 260
chart.height = 160
chart.x = 20
chart.y = 20
chart.data = [[1,2], [3,4]]
chart.categoryAxis.categoryNames = ['foo', 'bar']
chart.valueAxis.valueMin = 0
d.add(chart)
d.save(fnRoot='test', formats=['png', 'pdf'])
alt text http://i40.tinypic.com/2j677tl.jpg
Note: the image has been converted to jpg by the image host.
CairoPlot
I used pychart and thought it was very straightforward.
http://home.gna.org/pychart/
It's all native python and does not have a busload of dependencies. I'm sure matplotlib is lovely but I'd be downloading and installing for days and I just want one measley bar chart!
It doesn't seem to have been updated in a few years but hey it works!
Have you looked into ChartDirector for Python?
I can't speak about this one, but I've used ChartDirector for PHP and it's pretty good.
NodeBox is awesome for raw graphics creation.
If you like to use gnuplot for plotting, you should consider Gnuplot.py. It provides an object-oriented interface to gnuplot, and also allows you to pass commands directly to gnuplot. Unfortunately, it is no longer being actively developed.
Chaco from enthought is another option
You should also consider PyCha
http://www.lorenzogil.com/projects/pycha/
I am a fan on PyOFC2 : http://btbytes.github.com/pyofc2/
It just just a package that makes it easy to generate the JSON data needed for Open Flash Charts 2, which are very beautiful. Check out the examples on the link above.
Please look at the Open Flash Chart embedding for WHIFF
http://aaron.oirt.rutgers.edu/myapp/docs/W1100_1600.openFlashCharts
and the amCharts embedding for WHIFF too http://aaron.oirt.rutgers.edu/myapp/amcharts/doc. Thanks.
You could also consider google charts.
Not technically a python API, but you can use it from python, it's reasonably fast to code for, and the results tend to look nice. If you happen to be using your plots online, then this would be an even better solution.
PLplot is a cross-platform software package for creating scientific plots. They aren't very pretty (eye catching), but they look good enough. Have a look at some examples (both source code and pictures).
The PLplot core library can be used to create standard x-y plots, semi-log plots, log-log plots, contour plots, 3D surface plots, mesh plots, bar charts and pie charts. It runs on Windows (2000, XP and Vista), Linux, Mac OS X, and other Unices.
Related
I feel matplotlib is slow, and want to try other light-weight, agile graphic package.I mainly use plotting for business presentation, not scientific purpose. Any recommendation ?
You could try:
http://code.google.com/p/visvis/
http://code.google.com/p/cagraph/
or plplot's python binding ...
If you feel like you don't necessarily need to implement your code in Python, you could try Latex based plotting:
http://www.texample.net/tikz/examples/
http://pgfplots.sourceforge.net/gallery.html
There is also Chaco. It is not lightweight by any means but it is a fair bit faster than matplotlib in my limited tests.
http://code.enthought.com/projects/chaco/
I ended up staying with matplotlib however as it is more popular, so it has better community support for help with questions and such.
What's best open source library in Python to draw chart/diagram? 2D is necessary, and 3D is good if provided together. and it has to accept simple input data format like csv.
I googled one called: matplotlib, how is it and any others?
It should be best in terms of the reliability, performance, simple use and easy integration, etc., or a combination of them.
Thanks
From the official python wiki:
Over the years many different plotting modules and packages have been
developed for Python. For most of that time there was no clear
favorite package, but recently matplotlib has become the most widely
used.
matplotlib highlights for me:
easy to learn (based on matlab traditions but also features object-oriented paradigm)
reliable (well-supported, updated, and documented)
robust (check out some of the stuff you can do with it!)
large community of users (well-liked and highly regarded in many circles)
easy to integrate (works natively alongside numpy/scipy)
accepts TeX commands for special formatting
quite the accepted standard for both simple and complicated chart drawing
I personally use it for many purposes including making diagrams for work presentations, graphics for school papers, and even charts and images for formal scientific documentation in mathematics and computer science. Especially the TeX stuff is particularly useful to me.
So I think you had the right idea. Matplotlib came up first in your google search because it's by far the most reputable, and in general the most useful.
In case you want to investigate some others, here's a link to an overview of some available plotting tools on the official python wiki: http://wiki.python.org/moin/NumericAndScientific/Plotting#Plotting_Tools
Matlab and Mathematica both have features that allow the user to manipulate the contents of a plot using, say, a slider. For example, if you have a set of 3D data, it is easy to make a small program that lets you view 2D slices of a set of 3D data where the user can slide a slider to move through which slice is displayed. Is there anything in python that allows for this sort of capability without tons of effort? For example, is it possible to do such a thing in matplotlib, or something similar? I
Thanks.
My first thought would be Mayavi, which is great for data visualization, especially in 3D. It relies on VTK. It is included in the Enthought flavoured version of Python, together with Chaco for 2D plotting. To get an idea, look at Travis Vaught's nice screencast in Multidimensional Data Visualization in Python - Mixing Chaco and Mayavi.
It also possible to embed basic interactive functionalities (like slider) to Matplotlib, see matplotlib.widgets and the widget examples.
Finally, you can use rpy (or better, rpy2) and benefit from the R interface.
Have you looked at Vtk? http://www.vtk.org/ One of their demos does exactly what you're asking.
In principle, you can do it by help of MathGL. This is cross-platform GPL library for plotting.
For each mouse clicks you can find the x,y,z position in plot or clicked object and adjust (replot) some other information correspondingly. However you should handle mouse clicks by yourself (for example, using PyQt).
Another option is to use python within the SAGE computation interface/environment, which has the #interact command (see here for specific help on this command)
I am trying to create a GUI interface in VB to track... oh, nevermind.
Basically, I want to create a GUI in python to display data, but I am finding that mathplotlib is not suiting my needs. I would like to be able to highlight certain datapoints, have more freedom in the text drawn to the screen, have animations on data movement, and have dropdown menus for data points. From what I have seen, I do not believe that mathplotlib can do these things. What utility can I look into to better suit my needs?
I haven't used it myself but Chaco seems to fit some of your needs. It is more interactive than matplotlib and can be used to make quite interactive applications.
Chaco is a Python plotting application toolkit that facilitates writing plotting applications at all levels of complexity, from simple scripts with hard-coded data to large plotting programs with complex data interrelationships and a multitude of interactive tools. While Chaco generates attractive static plots for publication and presentation, it also works well for interactive data visualization and exploration.
(source: enthought.com)
QGraphicsScene/View from PyQt4 is a fantastic piece of code. Although your description makes me think that some upfront work will be necessary to make things work.
...don 't trust me, I'm biased ;) Get the library here and check the demos.
The equivalent of matplotlib in the PyQt world is PyQwt (matplotlib integrates with PyQt also, but with PyQwt the integration is smoother). Take a look at this comparison between matplotlib and PyQwt:
http://eli.thegreenplace.net/2009/06/05/plotting-in-python-matplotlib-vs-pyqwt/
PyQt + MathGL can do it easily. See this sample.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
What alternatives are there to pylab for plotting in Python? In particular, I'm looking for something that doesn't use the stateful model that pylab does.
Plotly lets you make graphs using a Python API, matplotlib, and pandas. Their IPython gallery has some example scientific graphs with the Python scripts that generated them.
Here's a sample:
Some recent exciting open source offerings:
ggplot is based on R's ggplot2, with aesthetically pleasing defaults and a really concise api. wants to be a matplotlib killer
bokeh makes interactive (html canvas) plots. emphasis on interativity + handling big data
vega translates JSON "plot descriptions" into SVG or Canvas-based interactive plots, and vincent is a declarative interface for generating the JSON specifications.
(source: fastly.net)
There is a list of Python-based plotting tools on the Python wiki.
You can always use the object-oriented framework for Matplotlib instead of the pylab interface.
I have used Gnuplot.py with great success.
I was in need of gnuplot interface for Python 3 but have found nothing. So I have ported Gnuplot.py to it.
See more info in the 'readme' of the [repository]. Hope this will help someone else in future.
There is also a old program for automating the reading, filtering, processing, interpolation and plot n-dimensional values from different sources (like libreOffice- or csv-files) and variable size:
diaGrabber.
You have to use some simple python-commands to create a case. After this you can manipulate the graphical output in an interactive GUI.
You can use simple gplot
MathGL is free (GPL) plotting library with large set of graphics types, and have Python interface too (also can use numpy arrays).