R geom_bar labellng sum of weights

this is my reproducible example library(ggplot2) library(dplyr) mydf<-data.frame(a = rep(c(1:3), each=2), b = c(0.5, 0.5, 1, 1, 1.5, 1.5)) mydf %>% ggplot(aes(x = a)) + geom_bar(aes(weight=b)) # and this is a variant getting the same result mydf %>% ggplot(aes(x = a, weight=b)) + geom_bar() Now I want to add the text labels geom_text() with corresponding… Read More R geom_bar labellng sum of weights

How can I show only Top 10 of this geom_bar graph? (ggplot, R)

plot_2 <- flights %>% filter(origin == "JFK", month %in% c(7, 8, 9), !is.na(dep_time)) %>% left_join(airports %>% select(faa, name), by=c("dest"="faa")) options(repr.plot.width = 9, repr.plot.height = 6) plot_2 %>% ggplot(aes(y = reorder(name, name, function(y) + length(y)))) + geom_bar(fill = "#4e0090") + theme_minimal() + labs(title = "Top Destinations people traveled to the most (summer 2013)", x = "Count",… Read More How can I show only Top 10 of this geom_bar graph? (ggplot, R)

Is it possible to put the frequency of each level on the x-tick label in ggplot?

As the title suggests, I would like to put the frequency of each level in the x-axis ticks with their corresponding label. For example, in the subtitle I have the total frequency of Question_3l. On each x-axis tick, I would like it to say the label, then on another line n=2. Here is some working… Read More Is it possible to put the frequency of each level on the x-tick label in ggplot?

Why would stat_summary not add up the labels on my barplot?

I have an aggregated dataset which looks like this one: place<-c(‘PHF’,’Mobile clinic’,’pharmacy’,’PHF’,’pharmacy’,’PHF’,’normal shop’,’pharmacy’) District<-c(‘District1′,’District1′,’District1′,’District2′,’District2′,’District3′,’District3′,’District3’) cat<-c(‘public’,’public’,’private’,’public’,’private’,’public’,’private’,’private’) Freq<-c(7,2,5,4,7,5,1,8) Q14_HH<-data.frame(place,District,cat,Freq) I create a barplot which looks great: plot<- ggplot(data = Q14_HH, aes(x=place,y=Freq,fill=cat)) + geom_bar(stat=’identity’) + labs(title="Where do you get your medicines from normally? (human)", subtitle=’Precentage of households, n=30′,x="", y="Percentage",fill=’Outlet type’) + theme(axis.text.x = element_text(angle = 90, hjust=1,vjust=0.5)) Now… Read More Why would stat_summary not add up the labels on my barplot?