Re: ggplot and geobar

50 views
Skip to first unread message
Message has been deleted

Roman Luštrik

unread,
Jun 19, 2017, 12:35:47 PM6/19/17
to bic ton, ggplot2
Create a new variables based on `p.value` and map it to some aesthetic (using e.g. ifelse()). If you want to do crosshatching, you will probably need to do some heavy lifting (https://stackoverflow.com/questions/2895319/how-to-add-texture-to-fill-colors-in-ggplot2/20426482#20426482).

Cheers,
Roman

On Mon, Jun 19, 2017 at 6:05 PM, bic ton <bict...@gmail.com> wrote:
Dear All,

I have data frame like this:

> head(df2)
      Model      value     Noir     p.value 
1 AC               5       Noion    0.885995 
2 AC               0.5       Noion    0.885995 
3 BC              7       Noion     0.00085 

I plotted it with this code:
ggplot(df2, aes(x=Model, y=value, fill=Noir)) +stat_summary(fun.y=mean, geom="bar", position="dodge", color="grey70")+stat_summary(fun.data=get.se, geom="errorbar", width=0.1, position=position_dodge(width=0.9))

you can see it in the attachment.

Now what I want is to mark models where p.value is < 0.05.  I made up those black lines(look like textiles) to say that those are significant
Note:  value change within the model  so I compute the mean
          P.value does not change within the model so the p.value is repeated for all lines of a model.

tanks for any hint
Bic

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.
Message has been deleted

Crump, Ron

unread,
Jun 20, 2017, 6:43:58 AM6/20/17
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.

Message has been deleted

Roman Luštrik

unread,
Jun 20, 2017, 6:55:06 AM6/20/17
to bic ton, Crump, Ron, ggplot2
If you search the internet for "width border bar ggplot2", something like this might come up:


Cheers,
Roman

On Tue, Jun 20, 2017 at 12:53 PM, bic ton <bict...@gmail.com> wrote:
Thank you so much Ron. I wonder if it is possible to increase the size of the borders (the color black) of q3 and q1 to make them more apparent and distinguishable for a reader. I also wonder about the legend FALSE and TRUE.

Thanks once again,
Bic

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Crump, Ron

unread,
Jun 20, 2017, 6:59:36 AM6/20/17
to bic ton, Crump, Ron, ggplot2
Hi Bic,

>I figured it out for the size just add size=2.

And try ?scale_colour_manual for the legend query.

Ron.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages