[Solved] Interactively Re-color Bars in Matplotlib Bar Chart using Confidence Intervals

This is how I would handle this: def recolorBars(self, event): y = event.ydata for i, rect in enumerate(self.rects): t, p, _ = sms.DescrStatsW(self.df[self.df.columns[i]]).ttest_mean(y) rect.set_color(self.cpick.to_rgba((1 – p) * t / abs(t))) When iterating through the bars, first test the value against the sample mean, then set the color based on p-value and test statistic t: (1 … Read more