How to color geom_bar by y-axis values?

0 votes
How to color geom_bar by y-axis values?
Dec 6, 2018 in Data Analytics by Ali
• 10,430 points
69 views

1 answer to this question.

0 votes

You can use cut

ggplot(cars, aes(x = as.factor(cyl))) +
  geom_bar(aes(fill = cut(stat(count), breaks = c(0, 8, 16, Inf)))) +
  labs(fill = "Breaks")
answered Dec 6, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

How to change y axis max in time series using R?

The axis limits are being set using ...READ MORE

answered Apr 3, 2018 in Data Analytics by darklord
• 6,170 points
127 views
0 votes
4 answers

How to remove NA values with dplyr::filter()

Can we create a alist as below ...READ MORE

answered Aug 5 in Data Analytics by anonymous
7,671 views
0 votes
2 answers

In data frame how to spilt strings into values?

You can do this using dplyr and ...READ MORE

answered Dec 4, 2018 in Data Analytics by Kalgi
• 41,620 points
55 views
0 votes
1 answer

How to join two tables (tibbles) by *list* columns in R

You can use the hash from digest ...READ MORE

answered Apr 5, 2018 in Data Analytics by kappa3010
• 2,020 points
60 views
0 votes
1 answer
0 votes
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
421 views
0 votes
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
256 views
0 votes
1 answer

How do I copy an excel file to my Rconsole with all the missing values?

You can use read.table function in the ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,040 points
37 views
0 votes
1 answer

How do I change background color in Rstudio

Follow this: tools > global options > appearance ...READ MORE

answered Nov 2, 2018 in Data Analytics by Maverick
• 10,040 points
57 views