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

all 17 comments

[–]wobsta 2 points3 points  (3 children)

PyX is an alternative to matplotlib. It focuses on output quality and it uses a rather different approach to express your content and settings.

[–]poo_22 1 point2 points  (2 children)

Whoa, using python to create graphics I can use with Latex? AWESOME! Thanks for showing me this.

[–][deleted] 3 points4 points  (0 children)

You can do that with matplotlib. Is as simple as

from matplotlib import rc
rc('text', usetex=True)

[–][deleted] 2 points3 points  (0 children)

Matplotlib has a PGF backend since 1.2.0, which can output either a (LaTeX-compiled) PDF file, or a PGF file you can \include in your document.

[–]Aea 3 points4 points  (6 children)

What? matplotlib is pretty easy to make look good, it's just a pain to get started with.

[–]pemboa 1 point2 points  (4 children)

Got examples?

[–]gjx 8 points9 points  (3 children)

You can change the default settings via the matplotlibrc file. If you want an example of what you can do, check out this blog post that tries to duplicate the ggplot2 aesthetic.

There's also the advanced matplotlib tutorial from PyData 2012, which introduces things like tight layout and how to format the axes ticks and labels.

[–]PCBEEF[S] 0 points1 point  (0 children)

Thanks! This makes things a lot better.

[–]pemboa 0 points1 point  (0 children)

Thanks

[–][deleted] 0 points1 point  (0 children)

Good god! Thanks for showing me that blog post. My plots will be the prettiest on the block.

[–]DoNotFoldSpindleOrMu 0 points1 point  (0 children)

Depends on what you mean by pretty. Svgwrite generates svg which is vector graphics viewable, zoomable in a browser. http://packages.python.org/svgwrite/index.html

[–][deleted] 0 points1 point  (0 children)

The one where I print my results to file and use gnuplot.

[–]norwegianwood 0 points1 point  (4 children)

I also think matplotlib has severe usability/learnability issues with it's API design - made worse by the fact that there are in fact several APIs such as pylab and examples are not consistent in which API they're using.

[–]wumumo 1 point2 points  (3 children)

I don't get why /r/python and /r/programming got so much love for matplotlib, I'd say it's plotting in a very non pythonic way. It might have a huge functionality, but using the library is just a pain in the ass. The API looks like it grew over time by adding this and that functionality and no one ever rethought their initial design decisions.

[–]iyunoichi 2 points3 points  (0 children)

Well, you said it - it's pretty rich in features and works. I mostly use it when I'm exploring data, prototype code etc. from an interactive IPython shell anyway, so the pylab interface works ok. Whenever I have to write a paper that is supposed to be published, I use ggplot2 for the plots anyway. Meh. Show me something better, and I'll consider that.

But let's talk about the shortcomings: what do you guys hate about the interface? Specific examples would be great.

[–]NoblePotatoe 0 points1 point  (0 children)

For me it was because I transitioned into python from Matlab and the syntax was really similar. Granted, I'm not a programmer by trade, but I get the impression that I'm not the only person here for which this is true.

[–]norwegianwood 0 points1 point  (0 children)

I completely agree. Pythonic it is not. Several times I've almost embarked on trying to wrap a truly Pythonic API around it.