Questions about geom_text

I am running the kaggle competition on the house prices estimate following the notebook provided by a professionals.You can check it on
https://www.kaggle.com/erikbruin/house-prices-lasso-xgboost-and-a-detailed-eda/report#missing-data-label-encoding-and-factorizing-variables
When annotate the bar plot,the code is shown below

ggplot(all[!is.na(all$SalePrice),], aes(x=MiscFeature, y=SalePrice)) +
        geom_bar(stat='summary', fun.y = "median", fill='blue') +
        scale_y_continuous(breaks= seq(0, 800000, by=100000), labels = comma) +
 geom_label(stat = "count", aes(label = ..count.., y = ..count..))

I am very confused about the geom_label arguments even though I searched the help list.What does the last line mean?Why I should also let

'y=stat(count)'

This is the old syntax for referencing computed variables (computed by the specified stat function i.e. stat = "count"), the new syntax would be stat(count)

Yes,I konw it.
I just do not konw what the line meaning
I want to add the number of each group on the plot
Are there any alternative ways?

I don't understand what you mean by this but you can map the label aesthetic to whatever variable you want. To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.