struggling in calling multiple interactive functions for a graph using ipywidgets

There are several ways to approach controlling a matplotlib plot using ipywidgets. Below I’ve created the output I think you’re looking for using each of the options. The methods are listed in what feels like the natural order of discovery, however, I would recommend trying them in this order: 4, 2, 1, 3 Approach 1 … Read more

I want to plot changes in monthly values from dataset spanning over few years with matplot.pylib, pandas

It is much easier if you split Year/month columns to separate series for each year import pandas as pd import matplotlib.pyplot as plt fig, axes = plt.subplots(figsize=(6,4)) df = pd.read_csv(“data.csv”) df2 = pd.pivot_table(df, index=”Month”, columns=[“Year”]) df2 = df2.reindex([‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’]) df2.plot(ax=axes) fig.savefig(“plot.png”)

pandas 0.21.0 Timestamp compatibility issue with matplotlib

There is an issue with pandas datetimes and matplotlib coming from the recent release of pandas 0.21, which does not register its converters any more at import. Once you use those converters once (within pandas) they’ll be registered and automatically used by matplotlib as well. A workaround would be to register them manually, import pandas.plotting._converter … Read more

Get data points from Seaborn distplot

You can use the matplotlib.patches API. For instance, to get the first line: sns.distplot(x).get_lines()[0].get_data() This returns two numpy arrays containing the x and y values for the line. For the bars, information is stored in: sns.distplot(x).patches You can access the bar’s height via the function patches.get_height(): [h.get_height() for h in sns.distplot(x).patches]