Is there any other graphic module besides matplotlib for Python? - python

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.

Related

Simplest way to publish matplotlib-like interactive animation to html?

I'm using matplotlib and python to make an animated scatter plot with points as 'balls' that bounce around, just like this:
https://jakevdp.github.io/downloads/videos/particle_box.mp4
It is interactive at runtime (with sliders to change velocity, attraction, etc), simulating on the go.
I would like to then publish it with the interactivity and all in html.
Problem: I don't know of a way to publish matplotlib interactivity to html directly.
So can I do it in python? Or is there a better way?
Which library (or program, if different from python) would you recommend as the simplest and fastest for this kind of project? I don't need "pretty" customizations and all that, I just need easy calculations and simulations (python) to then plot in a few easy lines of code (matplotlib). I do need to change the dots (balls) colors though.
I have looked at mpld3 that should wrap matplotlib around D3js. But I don't know anything about js and it is not very straightforward, so it would take me a bit to learn.
I have also looked at plotly, but it doesn't seem to have the same customization of the animation I need.
I have looked at Dash with plotly, but it would be a whole new environment to learn, and definitely overkill.
So the questions are: is there a way to output matplotlib interactive animations to html that I haven't found?
If not, what tools would you use to accomplish this project within a fast timeframe and shallow learning curve, based on my beginner/low intermediate python and matplotlib skill level?
Thank you!

New to Python, wondering if creating a specific graphic is possible

I'm brand new to Python (as in I just started looking at it today). My only other coding experience is in Matlab and a little bit in R. I can't do what I want to in Matlab, so I'm wondering if Python is the tool I need. I want to make a graphic similar to what is seen here: https://www.cbc.ca/news/technology/charts-climate-change-bar-codes-1.4802293
I have a matrix of weather data which I would use to create the colour values. Is something like this possible in Python, and if so could someone help me with finding some resources to learn how to do so?
Thanks!
Well, it seems ur looking to get some good visualizations, i bet you could start with visualization packages in python. Like ggplot2 in R, python has matplotlib, and seaborn libraries which can greatly help you to achieve this. Below are some resources you can look at : For matplotlib follow this : https://matplotlib.org/gallery/index.html
and for seaborn : https://seaborn.pydata.org/examples/index.html
Hope this helps!

What's best Python open source library to draw chart?

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

Python Graphing Utility for GUI with Animations

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.

Pretty graphs and charts in Python [closed]

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.

Categories