I can't take anymore Matplotlib's general approach of "plotting-by-side-effect".

Is there an alternative?

I'm looking for something closer in philosophy to Mathematica's Plot function, which returns a stand-alone Graphics object. This object encapsulates all the information needed to render the corresponding image. There's no notion of "the current figure" or "the current axes".

(I'm looking for something that I can use comfortably from python code.)

  • 2
    Welcome to Software Recommendations! What exact features do you need? Please check with How to ask for an alternative to some software for possible improvements of your question, increasing the chances for good and matching answers :) – Izzy Dec 16 '15 at 0:09
  • 1
    @Izzy: to put it bluntly, I want to be able to plot from Python anything I can plot from Mathematica. I know this won't happen in my lifetime, so I'm looking for the closest approximation to this utopian ideal. ("Why not just use Mathematica?" Because I work in a group where most people know only Python, at best.) – kjo Dec 16 '15 at 2:34
  • 1
    Thanks for the update, kjo – but that should be part of the question itself. Remember, you can always edit your posts :) (I'm not familiar with Mathematica – but if "anything I can plot from Mathematica" is not self-explaining, you might need to elaborate on that as well) – Izzy Dec 16 '15 at 6:07
  • 1
    Note that while plotting by side effect is the primarily advertised way of using Matplotlib, it is not obligatory. For an introduction to object-oriented plotting, see this. – Wrzlprmft Jan 21 at 18:45

There are a few alternatives that you might wish to look at:

  • plot.ly this does some very nice things and may be more of the style you would like, it can now be used offline and does tricks like embedding the java into a web page so as to give scrollable, zooming, etc., graphs - for python, R & Matlab it is free, open source and self hosted for Excel not so.
  • bokeh - again nice graphs - can be used from R, Scala & Julia as well as python.
  • ggplot - To quote the authors "ggplot sacrafices highly customization in favor of generall doing "what you'd expect"."
  • [New] [Cartify]4 gives a much more restrictive number of charts but aims to make life a lot simpler, (and more Object Oriented).
  • The old favourite matplotlib - very powerful but not necessarily the easiest to use and many of the examples you will find are based on the pyplot MATLAB style concept of the current current figure/axis - however it also provides an OO interface some examples of which you can find here so simply use it that way instead.

There is a nice overview here of some of the less painful to use visualisation tools.

From the comments of others not tried by me

  • Altair - Altair is a declarative statistical visualization library for Python. (ostrokach)
  • plotnine plotnine is an implementation of a grammar of graphics in Python, it is based on ggplot2. (hatshepsut)
| improve this answer | |
  • 7
    Landed on this because of bugs in the matplotlib library for Python. Plot.ly and ggplot both rely on matplotlib. Bokeh doesn't, so for anyone needing to get around bugs in matplotlib, its an alternative. – Twitch Feb 16 '16 at 16:42
  • 1
    Add Altair to the list. – ostrokach Nov 2 '16 at 22:01
  • 1
    Plotnine is the best ggplot implementation in python. – Hatshepsut Jul 18 '18 at 21:48
  • plot.ly would allow only one private plot, wouldn't it? Not sure if I want every plot to be public shared. Looking for other interactive plot alternatives. – Eduardo Reis Oct 18 '18 at 14:32
  • @EduardoReis - If you use plot.ly offline then all of the plots are private, in fact they are not even online unless you manually post them somewhere. – Steve Barnes Oct 19 '18 at 18:55

I'm developing advance PyQt applications and the main reason for not using Mathplotlib was that you can't create realtime complex graphs in 3D and 2D that updates at 60fps!

So I use: pyQtGraph Scientific Graphics and GUI Library for Python that uses OpenGL :)

PyQtGraph is a pure-python graphics and GUI library built on PyQt4 / PySide and numpy. It is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is very fast due to its heavy leverage of numpy for number crunching and Qt's GraphicsView framework for fast display. PyQtGraph is distributed under the MIT open-source license.

Some of example from web page and my own examples:

enter image description here enter image description here enter image description here

| improve this answer | |
  • @user11879, is pyQtGraph current? documentation seems dated at circa 2011 and using PyQt4, not 5? – alancalvitti Sep 27 '19 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.