Hacker News new | past | comments | ask | show | jobs | submit login

Matplotlib is one of the most user-unfriendly libraries I've had the displeasure to use. The most effective thing to do is to not use it at all.

If you can get away with it use pandas' plot, seaborn, altair, etc.




I have the opposite opinion. I'm a nuclear engineer in R&D and have been using it with much pleasure for many years. I find the graph I want in the incredible gallery and take a peek at the example code and am off. Sure I have to search around a little to polish the details but it always goes well.

https://matplotlib.org/3.1.1/gallery/index.html


I admit that almost everything I do with matplotlib is the result of searching for an answer rather than trying to navigate the API documentation. But that's true for most anything I do with programming these days. Stuff has just gotten so huge.

What I can't decide is if: a) matplotlib is difficult; b) plotting is inherently complex like writing sheet music; c) object oriented programming leads to gratuitous complexity. So I chalk it up to some combination of the three, but have never felt compelled to try anything different.

I don't do anything for publication, but I use plotting inside of software that I use for running lab experiments, prototypes of measurement hardware, and even in the factory. So I'm using Python for what people would have used LabVIEW for in the past. My programs need to produce readable plots without tweaking, because I don't know in advance what the data are going to look like. The combination of tkinter and matplotlib is really huge for me.


Sure I have to search around

Every single time! Unlike, say, numpy, where everything is consistent, makes sense, and works as expected almost always.


When doing more complex visualizations I usually have to search around anyway, for inspiration, because I don’t know exactly what I want to draw.


Everyone I know at $big_research_lab uses it and hates it. But what are the alternatives really? Altair plots are larger than you dataset, plotnine has totally unusable docs and insane behaviour in some places (look up what plotnine's gg.ylims does; I'd bet it's caused more than one peer-reviewed error.), and further seems to have basic operations like drawing a vline scale in slowness with the size of your data. Plotly is commercial, raw d3 is inconvenient from python. The situation is deeply unfortunate.


> Plotly is commercial

Since their 4.0 release (https://medium.com/plotly/plotly-py-4-0-is-here-offline-only...), there's no longer any connectivity to their cloud service, it's "offline only". It used to have an offline interface _and_ a connected interface, now it's offline only.


Plotly.py is indeed developed primarily by employees of Plotly the company, but it's a 100% free/open-source, MIT licensed library that works totally offline and doesn't depend on any external service or require any kind of registration :)

See https://plot.ly/python/is-plotly-free/ for full details.


IMO plotting things is pretty easy, if it’s so bad it seems like it would be easier to just use draw with pillow/tkinter.

You could always even just write out GNU Plot commands and then call it. I used that for the test harness I wrote in the robotics club (and everything was in C!) to plot the trajectory of the robot in auto mode. It’s super easy! I don’t remember if the GUI has all the panning and scaling though.


Oh, seaborn is tightly coupled to matplotlib, so I don't really distinguish the two in my complaining, but you should definitely be using seaborn.


what is wrong with plotnine's ylim?


Clips your data, changing the behaviour of smoothers etc, iirc gg.cartesian(ylim=...) is the thing that people usually want.


I definitely felt that way when learning matplotlib at the start. But, after spending a good amount of time learning the object oriented api I find it insanely expressive. It can get verbose, however I have full control over every part of the viz. The worst feeling for me is spending an hour to get plot to a good spot just to learn all the finishing touches of like to make to the axes, ticks, annotations, etc are not possible or only possible via hack. matplotlib May have some large initial hurdles but once you get over those you get full control of your viz. To be fair, there’s no reason one should have to suffer as much as one does when learning matplotlib. It’s worth it to stick it out imo.


I think the reason it's awful is because they prioritized making the transition from Matlab easy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: