I have a set of data that I\'m trying to plot using a FacetGrid in seaborn. Each data point has a weight associated with it, and I want to plot a weighted histogram in each
You'll need to write a little wrapper function around plt.hist
that accepts a vector of weights as a positional argument. Something like
def weighted_hist(x, weights, **kwargs):
plt.hist(x, weights=weights, **kwargs)
g = sns.FacetGrid(df, ...)
g.map(weighted_hist, "x_var", "weight_var")
g.set_axis_labels("x_var", "count")