6 ms·
Matplotlib 3.6
- q_revert 4y agothe extensibility of matplotlib is simply incredible to me. I've always found the main limiting factor to be my imagination, once I wrap my head around what I want a plot to look like I know matplotlib will facilitate it. An absolute marvel, and a credit to the devs
- oli5679 4y agoI find using this library really confusing because of the two different APIs -matlplotlib.pyplot and the figures and axes of created plots. Documentation and other peoples' code seems to jump between the two. It's a really good example of the downsides of having too many ways to do the same thing in the same library.
- santiagobasulto 4y agoFigures and axis is the OOP interface, and what I always recommend. Pyplot is a global namespace procedural interface similar to matlab. If you find an example online using pyplot, it’s easy to find the axis. counterpart. For example, plt.title() becomes axis.set_title(). Axes and Figure reference API docs are very good.
- jbay808 4y ago> Figures and axis is the OOP interface, and what I always recommend. No doubt, but half the time when I am looking online for how to do something off the beaten path, I find a documentation page or stackoverflow answer that (only) uses the other interface, and I have to flail about for a while to come up with the OOP equivalent.
- squaresmile 4y agoYep, I think the reference documentation is quite good. I always direct people to the quick start [0] and then look at the examples [1] to see how things are done. All examples have the plots and self-contained scripts so it's intuitive to search for what you want even if it's hard to describe or google. [0] https://matplotlib.org/stable/tutorials/introductory/quick_start.html https://matplotlib.org/stable/tutorials/introductory/quick_s... [1] https://matplotlib.org/stable/gallery/index.html https://matplotlib.org/stable/gallery/index.html
- Foivos 4y agoI had the same problem until I found this tutorial: https://github.com/rougier/matplotlib-tutorial https://github.com/rougier/matplotlib-tutorial If you wan something deeper the same person has written a book: https://github.com/rougier/scientific-visualization-book https://github.com/rougier/scientific-visualization-book
- quietbritishjim 4y agoThe comment you're replying to has a very specific concern: the difference between the OO and static APIs. The page you linked to didn't appear to address that, it's just a general tutorial. In fact, I can't even find where it mentions that aspect... It seems to assume you already know about that as a prerequisite.
- Foivos 4y agoYou are right. It does not address this concern specifically, but if you follow this tutorial to learn this library, hopefully, you will not get to have this concern. Regarding the different APIs, this page [1] from the documentation attempts to compare them and provide code that generates the same result using the the different APIs. [1] https://matplotlib.org/devdocs/users/explain/api_interfaces.html https://matplotlib.org/devdocs/users/explain/api_interfaces....
- patrick451 4y agoI don't think that two ways to do something is too many. It's nice to be able to just throw a plot on the screen with plt.plot(), but it's also nice to have the extra control the figure/axes OO interface gives you. Matlab works the same way.
- markrages 4y agoIt's in the name - a copy of Matlab's procedural API. So matplotlib is popular because they copied Matlab's original mistake. (The procedural / global state API is actually reasonable for interactive plotting from a REPL.)
- refactor_master 4y agoThis is what Copilot was made for. Auto-completing arcane incantations to render the correct font size for the legend, so I don’t have to look them up every time.
- orzig 4y agoAlthough it will struggle in the first few months of a library‘s update, because its training set does not include the latest examples (I would be curious to see whether it accounts for freshness at all - does it know the difference between examples in Python 2 and 3?)
- bowsamic 4y agoI love Matplotlib, but I have basically totally restyled it. I really don't like the default styling. Other than that, it is so much nicer to use than Mathematica's plotting tools...
- alonfnt 4y agoI'd love to see your style. I agree that the default one is not very pleasing, but I like the skills to make a good style.
- bowsamic 4y agoIt's very much one for journals. Here is one from my first paper https://ibb.co/373QMfV https://ibb.co/373QMfV. Actually here I think the one on the left is matplotlib and the one on the right is Mathematica... I basically like a bold box and serif fonts
- gtsnexp 4y agoFunny, conda seems stuck on 3.5.2 Anyone able to install 3.6.0 on a conda environment?
- NGRhodes 4y agoThe conda-forge channel appears to have it: https://anaconda.org/conda-forge/matplotlib https://anaconda.org/conda-forge/matplotlib
- twarge 4y agoPersonally I find the style and whitespace defaults in matplotlib to be surprisingly displeasing. It always looks like "I just threw this together—I'll fix it later." Sure, you can fix it, but it's a huge fight. PyX is a much better alternative. Like TeX, everything you make looks great. edit for links: https://pyx-project.org/examples/graphs/index.html https://pyx-project.org/examples/graphs/index.html https://sourceforge.net/p/pyx/gallery/index/ https://sourceforge.net/p/pyx/gallery/index/
- jethkl 4y agoThe "I'll fix it later" aesthetic of matplotlib is addressed well by seaborn [1], which is built on top of matplotlib. Seaborn also works gracefully with Pandas. The killer feature for me of seaborn is "sns.despine()". PyX is new to me, but it looks like it hasn't been updated in a while [2, 3]. [1] https://seaborn.pydata.org https://seaborn.pydata.org [2] https://pyx-project.org/news.html https://pyx-project.org/news.html [3] https://github.com/pyx-project/pyx https://github.com/pyx-project/pyx
- twarge 4y agoOh seaborn does look like an improvement. Honestly there is no need to update it because it is already perfect. It is like TeX in that way. However there is some missing stuff like contour plots.
- funstuff007 4y ago+1 on Seaborn. I'd never make anything for outside consumption direct from matplotlib. If I need it done quickly, Seaborn looks professional.
- hprotagonist 4y agobut, drags in pandas.
- Scene_Cast2 4y agoEven standalone (feeding numpy arrays), I found it choking when going past 30k points in certain scenarios (2d heatmaps IIRC).
- ollysb 4y agoAs a relative newcomer to python/data science I found it really surprising that Matplotlib seems favoured over Plotly. The Plotly API seems better designed and the output is far superior. Is matplotlib just favoured out of momentum or does it have advantages that I haven't found yet?
- pletnes 4y agoWhen I started out there was no plotly. Then plotly required uploading data to their servers. It’s only recently that there’s a real choice IMHO.
- pletnes 4y ago…also «old folks» like me know matplotlib already, there is existing code out there for matplotlib. Matplotlib fits into desktop software and print-quality plots - plotly is more about web plots. Libraries like pandas and seaborn use matplotlib. Really, there are quite a few reasons you might stick to it still. But keep using plotly - keep visualizing data. It’s a superpower!
- kzrdude 4y agoMomentum for a big part, and the libraries that build on top of matplotlib - like seaborn. And the default integrations with matplotlib (pandas, xarray, and a million others)
- patrick451 4y agoPersonally I can't stand plotly. The only thing plotly does better is give you a nice interactive tooltip. While I wish matplotlib were better in that regard, it's usually not enough to get me to switch. Off the top of my head, these are the main pain points I have with plotly: - It's slower than molasses in January for anything more than a few hundred data points. It regularly crashes VScode with the jupyter notebook plugin if I try to plot even 10 minutes of 100 hz data. That alone makes it a cheap toy. In gradschool, I was plotting hours of 25 kHz data in matlab with no problems. - It's display mechanism is to show you plots is a web browser. I can't stand that. It's really slow to open a new browser tab for every plot. They don't re-use browser tabs, so after iterating for 10 minutes you have 20 open tabs. - It's basically useless outside of a Jupyter notebook. If you try to use plotly outside of a jupyter notebook and want more than a single plot, good luck. At best you get different plots in different browser tabs, which is useless. Or you end up wasting time creating a web app just to view data. - It's missing really basic functionality, like separate legends for different subplots. - Maybe just personal preference, but I can't stand it's declarative interface. It leads to way more duplicated code and is too inflexible.
- cycomanic 4y agoMatplotlib is very powerful and one can do great plots with it. I always find the process of creating great plots quite cumbersome and it involves a lot of trial and error, in particular when one has multiple subplots. I find proplot is a great wrapper that makes consistent plots much easier https://proplot.readthedocs.io/en/stable/ https://proplot.readthedocs.io/en/stable/
- billfruit 4y agoIs its 3d plot as rich and interactive as it's 2d plots?
- ducktective 4y agoI recently asked why MATLAB plots are better looking (for me) than Matplotlib or Gnuplot... https://news.ycombinator.com/item?id=32638952 https://news.ycombinator.com/item?id=32638952
- analog31 4y agoThe one answer you got was that people don't care. I have another answer, which is that really sweating the details of visual interfaces, and handling all of the edge cases that users can discover, is one of the things that makes commercial software extremely costly to develop. Open source software has to focus on what can be done by the available time and effort of much smaller teams.
- Beardid 4y ago
- amelius 4y agoDoes it still have the issue that all drawing has to be done on the main thread?
- mejutoco 4y agoI do not have hard facts but bear with me. I always thought matplotlib interface/abstractions (as in, the code you write) felt shoehorned somehow. One day I tried the plotting in R lang and it was so natural. I felt like matplotlib was a somehow unnatural port of it. It is one of those projects that work, but feels weird. I think of it as I think of pandas or celery.