..sumprop.., ..sumpct.. in the bin Statistic¶import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
print(df.shape)
df.head()
g = ggplot(df, aes(x="cty")) + facet_grid(x="cyl")
# Default plot
g + geom_histogram(binwidth=5, center=5)
# When y='..sumprop..', sum of values in each group is equal to 1
g + geom_histogram(aes(y='..sumprop..'), binwidth=5, center=5)
# When y='..sumpct..', sum of values in each group is equal to 100
g + geom_histogram(aes(y='..sumpct..'), binwidth=5, center=5)