Crump, Ron
unread,Jun 20, 2017, 6:43:58 AM6/20/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bic ton, ggplot2
Hi Bic,
>I have now an example:
Thanks. That makes it much easier to help.
>choosev <- c(0.005,0.005,0.4,0.4,0.0205,0.0205,0.05,0.05)
>Var1 <- rep(c("A1","A2"),4)
> Var2 <- c("Q1","Q1","Q2","Q2","Q3","Q3","Q4","Q4")
> Freq <- c(4,2,6,2,6,4,9,3)
> df <- as.data.frame(cbind(Var1,Var2, Freq,choosev))
You don't need the cbind and using df as a data.frame name is not
recommended as df is an R function (density of the F distribution):
DF <- data.frame(Var1,Var2,Freq,choosev)
>ggplot(df, aes(x=factor(Var2), y=Freq))+
>geom_bar(stat="identity", aes(fill = Var1), position="dodge")+
> geom_bar(stat="identity", aes(color = ifelse(as.numeric(choosev)<0.05,
>'black', 'transparent'), group = Var2), fill = NA, size = 3)
>
>this give plot 1
I don't think it does. At least not on my screen.
> what I need is plot 2
Try this:
ggplot(DF,aes(x=factor(Var2),y=Freq))+
geom_bar(stat="identity",
aes(fill=Var1,
colour=choosev<0.05),
position="dodge")+
scale_colour_manual(values=c(NA,"black"))
Ron.