TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Effectively Using Matplotlib

375 pointsby kerckeralmost 8 years ago

21 comments

pweissbrodalmost 8 years ago
I needed jupyter as a medium of information sharing in my team but matplotlib has just too much of a learning curve to expect everyone to adopt it as tribal knowledge considering this was not a core part of their job. I found a compromise using the wonderful jupyter_pivottablejs library:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;nicolaskruchten&#x2F;jupyter_pivottablejs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nicolaskruchten&#x2F;jupyter_pivottablejs</a><p>Thus allowing you to tweak visualizations on the fly without touching code. My workflow is:<p>sql -&gt; dataframe -&gt; pivottable<p>This is not a dig at matplotlib which is undeniably powerful. More like an alternative for those of us that want to convey good-enough flexible interactive visualizations without getting into the minutia with matplotlib
评论 #14672841 未加载
评论 #14671423 未加载
评论 #14691399 未加载
denfromufaalmost 8 years ago
State of visualization in Python by Jake Vanderplas:<p><a href="https:&#x2F;&#x2F;speakerdeck.com&#x2F;jakevdp&#x2F;pythons-visualization-landscape-pycon-2017" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;jakevdp&#x2F;pythons-visualization-landsc...</a>
joferalmost 8 years ago
Another useful guide is Ben Root&#x27;s Anatomy of Matplotlib tutorial: <a href="https:&#x2F;&#x2F;github.com&#x2F;WeatherGod&#x2F;AnatomyOfMatplotlib" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WeatherGod&#x2F;AnatomyOfMatplotlib</a><p>I&#x27;m a bit biased, as I wrote this particular section (most of the rest is Ben&#x27;s work), but the plotting method overview is a very useful cheatsheet: <a href="http:&#x2F;&#x2F;nbviewer.jupyter.org&#x2F;github&#x2F;WeatherGod&#x2F;AnatomyOfMatplotlib&#x2F;blob&#x2F;master&#x2F;AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb" rel="nofollow">http:&#x2F;&#x2F;nbviewer.jupyter.org&#x2F;github&#x2F;WeatherGod&#x2F;AnatomyOfMatpl...</a><p>It gives you a compact visual representation of what the main plotting methods do and the differences between them.
NicoJuicyalmost 8 years ago
I&#x27;m picking up reinformencent deep learning and documenting progress with jupyter notebook.<p>Improving my python on the way ( and knowing numpy and matplotlib) has been a great experience the last 2 days. Although the progress seems to be &quot;slow&quot; ( translating formulas, n armed bandits to code ...). My best tip: download cheatsheets for: numpy, pandas, matplotlib, python, ... has been good for getting to know the language and libraries for ML.<p>So this tutorial&#x2F;information will be put in good hands at a very opportunistic time ;) Thanks!
评论 #14669477 未加载
Twinklebearalmost 8 years ago
A cool feature I recently learned about of matplotlib is that it supports LaTeX for text rendering [1]. You can go as far as rendering LaTeX math formatting for titles&#x2F;labels, or just have the plot fonts match your text and&#x2F;or figure captions so it fits nicely into your paper.<p>[1] <a href="http:&#x2F;&#x2F;matplotlib.org&#x2F;users&#x2F;usetex.html" rel="nofollow">http:&#x2F;&#x2F;matplotlib.org&#x2F;users&#x2F;usetex.html</a>
评论 #14670964 未加载
bitLalmost 8 years ago
matplotlib is an example of unnecessarily complex and confusing &quot;organic&quot; API. That&#x27;s why there is so much resentment to use it; trivial things need non-trivial internal understanding and confusing boilerplates.
评论 #14669382 未加载
评论 #14669729 未加载
评论 #14671119 未加载
rjtavaresalmost 8 years ago
One aspect of matplotlib that is often overlooked is the animation capabilities. There should be more animations in data-sciency stuff (there&#x27;s a reason small gifs spread so easilly on the internet).
评论 #14669588 未加载
评论 #14670773 未加载
评论 #14669217 未加载
评论 #14671226 未加载
评论 #14669207 未加载
jbmorgadoalmost 8 years ago
I want to vouch for Matplotlib, I can see it gets a bad reputation when compared to these new shiny frameworks like plotly, but it&#x27;s vastly more powerful.<p>If you are a researcher and you want to publish in B&amp;W (something still very common in fields like Physics and Astrophysics), no other plotting library for Python comes near.<p>You can choose filling patterns, line patterns, annotate with LaTeX, etc. And, although hard, you can make your final product look as polished and perfect as you want (and as you are willing to take the time). No other library for Python comes near in these aspects.<p>There are simpler tools and it&#x27;s easy to get a good enough looking plot, but if you want to get that perfect one exactly as you need, there&#x27;s no way around Matplotlib (at least amongst the well known Python plotting libraries).
analog31almost 8 years ago
MPL is my go-to graphing tool, but admittedly it&#x27;s probably because I learned it first and now it&#x27;s a habit. Almost every Python &#x2F; Jupyter tutorial starts you out with MPL. But there are two things I like about it:<p>1. Easy to embed MPL graphics in Tkinter GUI&#x27;s. Granted, my programs are not intended to be professional looking, but if I want to write stand alone software, e.g., for an automated experiment or industrial test, it invariably needs one or two graphs in a dialog.<p>2. If what you want is a static graph (no interaction), that&#x27;s what MPL produces. With other packages that I&#x27;ve tried, every graph is its own JavaScript program running in the browser. A Jupyer notebook with dozens of graphs begins to hog down my computer.
edshiroalmost 8 years ago
This looks like a great resource! I am currently picking up deep learning and one of the things that they understandably don&#x27;t cover much is how to use matplotlib.<p>But being able to visualise the problem or your solution is so important to build more intuition and become a better wannabe data scientist.
maxsalmost 8 years ago
I used matplotlib for a very long time. Now, I suggest using bokeh<p><a href="http:&#x2F;&#x2F;bokeh.pydata.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;bokeh.pydata.org&#x2F;</a><p>I am finding the API a lot cleaner than Matplotlib, and it is very nice to have the ability to do integrated interactive plots in Jupyter.
bravuraalmost 8 years ago
Biggest matplotlib frustration:<p>I&#x27;ve spent hours trying to get matplotlib to render on screen on OSX, and followed countless stackoverflow and blog posts instructions.<p>I still can&#x27;t.
评论 #14669997 未加载
评论 #14669885 未加载
评论 #14669805 未加载
imartin2kalmost 8 years ago
I&#x27;m currently learning to use Matplot by visualizing HN activity (very early stages) so this comes very handy. Thanks for sharing.
评论 #14669536 未加载
hyperpalliumalmost 8 years ago
How does matplotlib compare with gnuplot?
eyeballalmost 8 years ago
Anyone know of a good tutorial for plotnine? I&#x27;m new to graphing in python and am attracted to this because it should crossover to ggplot2 in R (which I&#x27;d also like to learn, but doing python for now). Will ggplot2 tutorials for R be enough to get going with plotnine?
评论 #14670167 未加载
NelsonMinaralmost 8 years ago
A fantastic and sorely needed tutorial for orienting matplotlib into modern usage. I really appreciated his description of the matlab-style API vs the object oriented API. Also how to use it with pandas&#x27; shortcut methods.
emilfihlmanalmost 8 years ago
Having the graph go beyond a point with the last axis number under it is annoying as hell and everyone who does that should feel bad.
kronos29296almost 8 years ago
Very informative. this clears up a lot of doubts I had because I was doing a lot of snippet copying for my plots before.
mynewtbalmost 8 years ago
Everyone, check out toyplot! It is a very easy python module for plotting.
j7akealmost 8 years ago
Are there any advantages of using matplotlib versus say ggplot2?
username4444444almost 8 years ago
from my personal experience, mpl&#x27;s 3D plotting capabilities are pretty terrible (just try log-scaling your axes) and looking into Mayavi as a replacement has been on the list for a while.
评论 #14670570 未加载
评论 #14669415 未加载
评论 #14669407 未加载