r - Bar in Bar Chart with ggplot2 -


this question has answer here:

is possible plot bar in bar chart in r ggplot2 figure below. want compare expected , actual values , want generate figure similar figure below. have provided dummy code:

 library(tidyverse)  df = data_frame(name = letters[1:10],profit = rnorm(mean = 100, sd = 20, n = 10),             target = profit + rnorm(mean = 10, sd = 10, n = 10))     df %>% ggplot(aes(x = name, y = profit)) + geom_bar(stat = "identity")  

enter image description here

yes possible, @ ggplot documentation

library(tidyverse)  df = data_frame(name = letters[1:10],profit = rnorm(mean = 100, sd = 20, n = 10),                 target = profit + rnorm(mean = 10, sd = 10, n = 10))  ggplot(df,aes(x=name,y=profit))+geom_bar(stat= "identity")+ geom_bar(aes(x= name,y=target),stat= "identity", width = 0.1,col = "green",fill="green") 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -