Reputation: 1
I wrote the code
ggplot(data = summary_datas) +
geom_bar(mapping = aes(x=member_casual,fill=member_casual)) +
labs(title = "Rider Membership data", subtitle= "Difference in the amount of registered riders based on category") +
theme(plot.title.position = "plot",plot.title = element_text(hjust = 0.5)) +
theme(plot.subtitle = element_text(hjust = 0.5)) +
scale_y_continuous(labels = scales::percent_format(accuracy = 1))
to create a bar chart in R with percentage values in the y-axis but my percentage is in thousands e.g. (10 000%, 20 000%) instead of tens. Please someone should help me out.
I tried using the ylim function but it didn't work
Upvotes: -1
Views: 44
Reputation: 3247
This is happening because the percent()
family of functions are designed to convert proportions (of 1) into percentages.
For example
library(scales)
label_percent()(1)
#> "100%"
label_percent()(.5)
#> "50%"
label_percent()(100)
#> "10 000%"
In order to get sensible labels you'll need to make sure that you're passing proportions to you scale function, rather than pre-formatted percentages.
Upvotes: 1