Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_text with geom_bar #110

Open
eoteroe opened this issue Jul 18, 2024 · 1 comment
Open

geom_text with geom_bar #110

eoteroe opened this issue Jul 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@eoteroe
Copy link

eoteroe commented Jul 18, 2024

geom_bar provides automatic statistics, example "counts". So when you want to add label, you use in ggplot2
geom_text(aes(x=x, y=..count.. ,label=..count..),stat="count"). and you will have the counts with a label. Is there a way to do this without transforming the data.

the example

library("ggplot2")
library("ggplot2movies")
mov <-subset(movies, year>2000 & mpaa !="")
ggplot(mov)+geom_bar(aes(x=year))+geom_text(aes(x=year,y=..count..,label=..count..),stat="count",vjust=-1)
@eoteroe eoteroe added the enhancement New feature or request label Jul 18, 2024
@rdboyes
Copy link
Member

rdboyes commented Aug 31, 2024

For this specific example, makie has the option bar_labels that you can use inside of aes - but the general functionality isn't there, no. Hopefully this will be added in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants