by ryan-duve · 2y ago · 0 comments
If you need to learn a plotting library and you already work in Pandas, I recommend choosing Altair to learn. It's a natural extension to pd.DataFrame and the only magical incantation to learn is
alt.Chart(df).mark_<plot_type>.encode(x=df["col"], y=df["other_col"])
I find this significantly easier to work with than Matplotlib, where the same things can be done in several ways with subplots, plt.figure(), df.plot(), and maybe others?My only complaint with the library is that outputting to an image file feels weirdly complicated. I often resort to making HTML files and taking a screenshot if I don't want to take the time to look up all the steps equivalent to `.savefig("file.png")`.
(Disclaimer: I'm a Vega-Altair maintainer and the author of vl-convert)