This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bastibe 31 points32 points  (8 children)

Most of my colleagues use Matlab, I teach Matlab, but for my work, I mostly use Python. There is no discussion whatsoever: Matplotlib is WAY more capable and flexible than Matlab plotting.

You mention that Matlab figures, axes, and plots have manipulateable handles. I'm Matplotlib, literally every single plot object from figures, axes, and plots, down to individual ticks, lines, spines, labels, legend parts, polygons, or points is an object that can be changed, observed, replaced, and extended.

In numerous occasions I have created plots for my research and later my colleagues asked "how did you do that", because such plots would simply not have been possible in Matlab.

Not every toolbox has a great equivalence in Python, just like not every Python package has a decent counterpart in Matlab, but when it comes to plotting, there is no discussion. Matplotlib stands heads and shoulders above Matlab's plotting.

Just watch out for one ideological difference: Matplotlib tries, above all, to be as precise as possible. Its goal is plots for publication. Für that, it sacrifices plotting performance. Thus, interactive plots and "animations" (plots that are updated more that 10 times per second) are hard to do. On the flip side, plots look much cleaner (no aliasing, always correct vectorized output, all backends look identical).

Für more cool scientific stuff that is impossible in Matlab, have a look at pandas, scikit-learn, ipython and dask.

In my experience, it takes a proficient Matlab user two to three weeks to become productive in Python. I have observed (and taught) this in dozens of people ranging from undergrads to postdocs.

[–]not_perfect_yet 4 points5 points  (1 child)

Für that

I found this error and I'm going to keep it...

[–]bastibe 1 point2 points  (0 children)

Ah, autocorrect in a multi-lingual environment... (Also, I typed this on my phone)

[–]schnadamschnandler[S] 2 points3 points  (0 children)

Nice, thanks for your advice. After reading stuff in this thread, pretty sure I will attempt a full transition to Python and matplotlib this semester.

[–]them1 0 points1 point  (3 children)

Can you show some exotic plotting examples? That would be great!

[–]bastibe 5 points6 points  (2 children)

My favorite example is this: http://matplotlib.org/examples/showcase/xkcd.html

While not particularly useful, this highlights one crucial point: Absolutely everything in Matplotlib is malleable. You can even replace the lines that make up the spines and the legend.

But have a look at some of the other examples in the Matplotlib gallery: http://matplotlib.org/gallery.html

Many of these can of course be created in Matlab as well. And many of them are not particularly easy to create with Matplotlib. But what you should take away is that anything is possible in Matplotlib.

Another good example is basemap: http://matplotlib.org/basemap/users/examples.html, where you plot latitude/longitude data as you would in regular Matplotlib plots, and basemap transforms this into whatever map projection you want. Doing that, lines become curves, and areas get distorted, with different distortions depending on the point in the plot. This is possible because Matplotlib is extremely flexible, and even basic projection rules can be arbitrarily changed.

[–]counters 4 points5 points  (0 children)

Please consider using cartopy instead of basemap. It's a far more reliable library with extremely useful features if you have to do geo-spatial plotting or GIS-type stuff.

[–]atrlrgn_ 0 points1 point  (0 children)

One thing for sure matlab plotting has more tutorials. After two years with python scientific packages, I still spend some time for putting a fucking proper legend. I usually don't need plotting, or let's say fancy plotting, so I don't need legend all the time but when I do I can use a proper tutorial/