What is an (x,y) plot alternative to matplotlib in Python?
Asked Answered
U

6

13

I've been trying for several hours to download/build/install/use matplotlib and am at my wit's end. I finally got it to build and it runs but doesn't display anything despite calling plt.show().

Is there an alternative to matplotlib? I just need something in Python to graph (x,y) data, in either lines or points. (I'm running Python 2.7 in Mac OSX 10.6)

edit: please point me at a source of binary installers for any reputable package besides matplotlib. Building from source code on my machine seem to have trouble for some reason.

Unorthodox answered 21/1, 2012 at 19:58 Comment(3)
I'm beginning to think matplotlib is some giant hoax :/Aquanaut
I second this. Matplotlib's build environment just doesn't seem to work well. I've already spent hours trying to make it work on a linux cluster without internet access. First the dependencies weren't well documented, then I have to edit .h files just to make it compile, then I get linker errors because for some reason the gcc linker flags weren't set up correctly. With g++ there's a different set of linker errors. It may have to do with the fact that the cluster runs on SUSE linux which isn't the most common - on the other hand most other linux software handles this just fine.Diadem
Didn't I hear about a ggplot for Python?Translate
U
2

Since posting this question I found out about the free Anaconda Python which has precompiled binaries for the major platforms, and includes matplotlib, so I've been using that.

Unorthodox answered 22/5, 2015 at 16:19 Comment(0)
A
1

Even the .dmg files don't install, say, from here?

There are other options though. There's Chaco, gnuplot, and you can call R from Python, etc.

Archegonium answered 21/1, 2012 at 20:19 Comment(7)
the sourceforge binaries are for OSX 10.3, 10.4, and 10.5; 10.6 and 10.7 are 64-bit OS's and are not compatible. >:(Unorthodox
...and I just tried sudo port gnuplot which took the better part of an hour only to fail towards the end. sigh. :-(Unorthodox
Really, dmg won't work? I'm running OSX 10.6 and am quite sure I installed matplotlib from one of the official matplotlib dmgs, though it was awhile ago and I'm not 100% sure where I got the dmg. (All my notes say is, "I couldn't install matplotlib successfully with either pip or easy_install, so I used the .dmg file")Archegonium
Nope, I get ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: no matching architecture in universal wrapperUnorthodox
...but that's not the point. I'm looking for something that installs easily on other systems; even if I get it to work, I need to give my python scripts to someone else & there's no way they'll have as much patience as I do trying to get it to work.Unorthodox
The issue is almost certainly at 64/32 bit issue, and you're running Python in 64 bit but matplotlib only has a 32 bit dmg version. You can probably get yours running by starting Python with a command like python2.7-32 and see how that goes. If you want to completely avoid this issue, I don't know any "binary installers" for plotting packages that have a 64-bit version, but you could instead go for a pure python plotting package, like PyChart, home.gna.org/pychart .Archegonium
Also, I generally find setting up a whole environment, with a bunch of different packages, etc, to be some effort. Whether this is Python, Eclipse, VC++, etc, it's always a hassle. If a client needs this, I do it for them. Other solutions are to put things in a self-contained and self-consistent bundle using something like, py2app, etc, and then they just click and go; or you could do an installer (I've no experience here). It seems to me though, if you're expecting someone to install multiple packages, making a note of the 64/32 bit problem will be the least of your worries.Archegonium
S
1

Take a look at PyCha or pyCairoChart if you are looking for simple Matplotlib alternatives. They are of course not as mature or versatile as Matplotlib is, but they might be enough for you.

Summerlin answered 21/1, 2012 at 21:48 Comment(1)
The link for the pyCairoChart is broken. Here is an existing one: launchpad.net/pycairochartBurier
A
1

If you just need to plot points and lines, you could use Tkinter (which is probably already installed) and use a canvas widget. It's pretty much what it sounds like: a blank canvas with primitives for drawing lines, points, etc.

Argentinaargentine answered 21/1, 2012 at 22:51 Comment(0)
L
0

First, matplotlib should be installable and most python plattforms, it has become a de-facto standard for plotting with python. I'm sad to read that you are struggling with the installation.

Second, you could have a look at ScientificPython (not to confuse with scipy). It has a simple TkPlotCanvas, providing some abstraction around the TkInter canvas widget. Maybe you can find a way to incorporate the relevant parts into you project. The license is CeCILL, yet another open-source variant. I don't know about your project and its license, but this could lead to seamless integration of plotting, without external dependencies.

Lum answered 3/1, 2013 at 10:9 Comment(1)
The problem is that matplotlib now requires Python3.6, and a default install for 3.6 is not readily available in Ubuntu 16.04. It requires doing some complicated workarounds to get matplotlib working. There's always Anaconda though.Lieberman
I
0

You could try the Charts library which enables you to make plots in Python using the excellent javascript Highcharts library.

The library is mainly HTML/Javascript and only uses python standard libraries so it installs easily on any platform. Compared to matplotlib it offers almost all of their features and is able to make interactive charts!

Disclaimer: I'm the developper of the library.

Imaginable answered 22/5, 2015 at 12:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.