r/Python • u/mangecoeur • Jan 17 '17
Matplotlib 2.0 final released
https://github.com/matplotlib/matplotlib/releases11
u/khouli Jan 17 '17
Does Matplotlib have any serious competitors in the Python world that don't use Matplotlib as a backend?
12
u/mangecoeur Jan 17 '17
Not really IMHO, at least not if you are talking about publication-quality plots. There's some interesting efforts around interactive plotting like Plotly and Bokeh, but I've found them relatively immature (you quickly find issues when you move beyond the demo plots) and generally not great if you need detailed control of style and output formats for print.
0
Jan 18 '17
[deleted]
1
u/muntoo R_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} Jan 18 '17
Apparently you can do
plt.savefig('/path/to/pic.png')instead ofplt.show()3
u/troyunrau ... Jan 17 '17
pyqtgraph is pretty good. If you install it, run
python -m pyqtgraph.examplesto get a good feel for it. Their documentation sucks.But it's just so superior in a lot of contexts - particularly with large, complicated, real-time, or interactive data. I regularly throw hundreds of millions of points at a graph and have it respond without any lag.
3
u/dougthor42 Jan 17 '17
Their documentation sucks.
That's an understatement, but otherwise I fully agree that pyqtgraph is good.
There's also some very simple plotting in wxPython Phoenix. Good for things that don't need the power (or bloat) of matplotlib.
1
Jan 18 '17
But it's just so superior in a lot of contexts - particularly with large, complicated, real-time, or interactive data.
Aside from their examples any other good references for it? This is the type of data I have to deal with and it just chokes matplotlib. I just ran the example and plotted 2GB of random HDF5 data and it's ... fluid.
The default colors do remind me of PV-WAVE's defaults. What is it with 'scientific' data and white on black plots?
1
u/troyunrau ... Jan 18 '17
Nope - like I said, the docs suck. But it is really useful. I load my data from raw formats into hdf5, then plot using pyqtgraph. I usually have a lot of subplots that are taking subsamples of the data under my cursor and doing things like histograms or fourier transforms on the 50,000 points nearest my cursor (or whatever).
It really helps if you know Qt or PyQt if you want to customize it. It's basically a giant QGraphicsView that they've added plotting widgets to. If you want to do things like override the mouse behaviour, the docs for pyqt will help you more than anything.
1
u/This_Is_The_End Jan 18 '17
pyqtgraph is very good at realtime data. It's not a problem to create a scrolling plotter with a minimum of CPU usage.
2
u/Kah-Neth I use numpy, scipy, and matplotlib for nuclear physics Jan 18 '17
Matplotlib has few serious competitors outside the python world. It is really a remarkable and robust framework for plotting. I hope one day we have a 3d plotting framework that is as flexible and malleable as matplotlib is for 2d (and no mplot3d does not count until it gets a renderer that can handle zorder properly)
1
u/khouli Jan 18 '17 edited Jan 18 '17
What are its serious competitors even outside the Python world? gnuplot and especially ggplot are the obvious candidates. Is there anything else?
3
u/Kah-Neth I use numpy, scipy, and matplotlib for nuclear physics Jan 18 '17
Gnuplot is not a serious competitor with anything. Xmgrace, MATLAB, Mathematica, origin, vuez(also python), root, R are a few. MPL is in my opinion vastly superior to all of them (maybe only superior but not vastly for R)
1
u/srivkrani Jan 18 '17
You forgot ParaView, one of the best opensource visualization software out there.
1
u/Kah-Neth I use numpy, scipy, and matplotlib for nuclear physics Jan 18 '17
First paraview is really for 3d plotting and I was very explicit in first comment to talk about only 2d plotting. Next, paraview is on of the only tolerable scalable data renderers, but I would by no means call it good. It is just the best of a set of mediocre options. Personally I found it difficult to customize my plot to be exactly what I want.
1
u/khouli Jan 18 '17 edited Jan 18 '17
Really? Gnuplot is out of the running but Xmgrace is in? To be fair, I only used Xmgrace a few times several years ago but my impression was that it was a last century relic.
1
u/Kah-Neth I use numpy, scipy, and matplotlib for nuclear physics Jan 18 '17
Xmgrace is still heavily used in theoretical physics (though declining as I and other younger scientist advocate MPL and R). To be fair though, xmgrace can make a decent plot where as gnuplot plots always look terrible.
2
1
1
u/Tarqon Jan 18 '17
Altair is amazing, I'd pick it over matplotlib for most tasks any day of the week.
129
u/holdie Jan 17 '17
FWIW, changing the default styles in matplotlib turned out to be a gigantic undertaking. While the final product may seem aesthetic, the process uncovered a ridiculous number of bugs, inefficiencies in API, etc. Props to the matplotlib team for finally getting this out, and hopefully starting down a path towards a bright(er) future of the package.
15
u/Sean1708 Jan 17 '17
Do you have any information on what those difficulties actually were?
13
u/skiguy0123 Jan 18 '17 edited Jan 18 '17
PyData Carolinas 2016 | Presentation: Matplotlib 2.0 or "One does not simply change all the ...
Edit: sorry not sure how I fucked up that link
1
37
u/miserlou Jan 17 '17
The rationale behind the new default colorscheme is super fascinating, and there is a brilliant talk on it available here: https://www.youtube.com/watch?v=xAoljeRJ3lU
4
u/dgreenmachine Jan 17 '17
Really good watch, speaker keeps it interesting along with good reasoning behind decisions.
2
u/troyunrau ... Jan 17 '17
This is excellent! I've been using cubehelix as my default for a while for most of these reasons, but it isn't as well designed.
2
u/NuclearStr1der Jan 19 '17
Cool story: Stéfan van der Walt, the guy who's there to "look pretty" lectured Applied Mathematics in my first year. And he was damn excellent. It's great to be able to point and say "I recognise that guy!".
1
u/muntoo R_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} Jan 18 '17
Loved it. :-)
I even... gasp!... shared it on Facebook
30
u/NelsonMinar Jan 17 '17
Here's What's new in matplotlib 2.0. "The major changes in v2.0 are related to overhauling the default styles."
5
u/troyunrau ... Jan 17 '17
Is there some sort of blog entry of visual comparison kicking around that anyone is aware of? This "what's new" is very rudimentary.
22
16
u/glacierre2 Jan 17 '17
Every single change for the default styling seems a good improvement.
Maybe I will be able to skip the 'import seaborn' when I need a quick but still nice looking plot.
14
u/EvM Natural Language Processing Jan 17 '17
You could already skip that:
import matplotlib.pyplot as plt plt.style.use('seaborn') # or 'ggplot', 'bmh', ...
10
Jan 17 '17
Great job! Defaulting to a better colormap should singlehandedly prevent some misinterpretation of data in the coming years.
11
Jan 17 '17
I was surprised that Matlab made the move to a reasonable default colormap before the python community did. At least now everyone's on the same page. Jet is the worst.
4
u/spinicist Jan 17 '17
Yeah, I was amazed Matlab beat them to it. The damage
jetdoes has been known about for what, a couple of decades now?
8
u/AustinCorgiBart Jan 17 '17
Oh wow, I love that barcharts now align to the center automatically. One fewer keyword parameter to explain to my students!
9
Jan 17 '17
I had no idea this could be solved with a simple keyword and have always written code that would calculate the required off-set to center the bars.
Tonight I'll be crying tears of sadness for the hours I've wasted, and tears of joy for the hours I will save
6
u/neuralyzer Jan 17 '17
Finally. So many nice and useful improvements! Thanks to all the developers.
5
u/cripcate Jan 17 '17
Yeah. Been waiting for this. Anyone know when it will come to anaconda?
5
Jan 17 '17
I just tried it out, works well! https://anaconda.org/conda-forge/matplotlib
5
u/cripcate Jan 17 '17
How can I switch from "normal" anaconda to conda forge?
3
u/pwang99 Jan 17 '17
You can just do "conda install -c conda-forge matplotlib".
We should have the 2.0 release available in the default channels very shortly.
1
u/spinicist Jan 17 '17
If I remember correctly, you don't switch, but specify
conda-forgeas the source when installing packages. I had to do it forseabornrecently but forgot the details already. Sorry.1
u/brombaer3000 Jan 17 '17
conda config --add channels conda-forgeThis adds the conda-forge channel to your ~/.condarc file and gives it priority over the default anaconda channel. If you want to change the priorities, just reorder the lines in .condarc
More info at https://conda-forge.github.io3
u/bheklilr Jan 17 '17
It's already on conda-forge if you want to grab the builds from there. In my experience the main channel will get it within a week or two, they run more tests against other packages before releasing. conda-forge uses continuous integration to get changed pushed faster, but with less indemnity.
2
u/AustinCorgiBart Jan 17 '17
So, in the next month or so, the newest version of Anaconda will probably have this new version of MatPlotLib?
3
u/bheklilr Jan 17 '17
Almost certainly within a month. The last major IPython update had more breaking changes and it was out within 2 weeks.
2
u/AustinCorgiBart Jan 17 '17
I'm happy as long as they fixed the bugs in Spyder from last fall. A number of little headaches there...
4
4
1
Jan 17 '17 edited Jan 17 '17
Can anyone get ipython to run %matplotlib with anything except agg with the new version? Even if I set matplotlib.use("TKAgg") before hand it just replaces it with agg as soon as I call the ipython magic.
Edit: nevermind, changed it in my matplotlibrc file
1
1
0
Jan 17 '17
[deleted]
6
u/billsil Jan 17 '17
Matplotlib has 3 main competitors. Bokeh, plotly, and PyQtGraph. The first two are geared towards in browser visualization, while PyQtGraph is geared towards real time graphing. Bokeh is still very much in beta, but it's coming along. You certainly can get real time performance out of matplotlib, but it's buried in the API.
I'm hardly an expert on anything besides matplotlib, so keep that in mind.
67
u/[deleted] Jan 17 '17
Does the API still have hundreds of getters and setters that should really be properties?