Alessandra Carioli
unread,Sep 10, 2014, 8:22:59 AM9/10/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggplot2
Dear all,
I am plotting a geom_line plot. My intention is to plot a line and get the parts of the graph that correspond to significant p-values either ’thicker’ or highlight them somehow (dots or else).
ggplot(my.data, aes(Year,MoranI,colour=factor(Type)))+
geom_line(mapping=aes(y=MoranI),size=0.6,linetype=1)+
labs(title = "", x = "", y = "") +
scale_x_continuous(breaks=c(1981,1985,1990,1995,2000),limits=c(1981,2000))+
scale_colour_manual(name = 'Contiguity',
values = rainbow(2, s = 1, v = 1, start = 0, end = max(1, 2 - 1)/2, alpha = 1),
labels=label_select
)+
scale_fill_discrete(name="legendName")
where:
p.value_logical =0 if the p-value is significant and 1 otherwise
Any help on the issue will be greatly appreciated!
Best regards,
Ale
reproducible sample:
my.data<–structure(list(Age = c(25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L), Type = c(23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L,
25L), Year = c(1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L,
1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L,
1997L, 1998L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L,
1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L,
1997L, 1998L), MoranI = c(0.212263626, 0.202790521, 0.169931088,
0.237828001, 0.27097048, 0.525170195, 0.355569798, 0.372083659,
0.390228718, 0.393121392, 0.358869702, 0.349731047, 0.394278365,
0.377251669, 0.317162436, 0.242740921, 0.380025414, 0.375429265,
0.192486937, 0.194747743, 0.150025994, 0.221372026, 0.253522174,
0.48276423, 0.319676152, 0.321374183, 0.33074163, 0.340413194,
0.320462638, 0.310112227, 0.343812682, 0.358390274, 0.259360467,
0.225973436, 0.346925459, 0.33972538), p.value = c(2.83e-16,
4.62e-15, 4.11e-11, 6.24e-20, 2.58e-25, 3.36e-89, 4.39e-42, 6.71e-46,
2.94e-50, 5.06e-51, 6.38e-43, 7.38e-41, 2.49e-51, 3.37e-47, 4.58e-34,
1.83e-21, 3.71e-48, 1.02e-46, 6.04e-10, 3.62e-10, 1.01e-06, 1.44e-12,
5.85e-16, 1.29e-52, 3.14e-24, 1.76e-24, 8.33e-26, 2.98e-27, 2.1e-24,
5.69e-23, 9.03e-28, 5.24e-30, 1.07e-16, 1.43e-13, 1.95e-28, 3.84e-27
), z.score = c(8.096414778, 7.749333844, 6.496658291, 9.064781881,
10.32999389, 19.99010897, 13.54241258, 14.17327197, 14.86122762,
14.97862476, 13.68340206, 13.3335947, 15.02585373, 14.38172059,
12.1117642, 9.441859228, 14.53356357, 14.30456352, 6.079175626,
6.160620663, 4.752309229, 6.98393946, 8.007477915, 15.22040728,
10.08738832, 10.14408354, 10.43782885, 10.74954117, 10.12672334,
9.798982207, 10.85907151, 11.31979243, 8.214285859, 7.300536998,
10.9981839, 10.72606417), data.var = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = "ASFR_25_all_1", class = "factor"), p.value_logical = c(0L,
0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L,
0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 0L,
0L, 1L, 0L)), .Names = c("Age", "Type", "Year", "MoranI", "p.value",
"z.score", "data.var", "p.value_logical"), class = "data.frame", row.names = c(NA,
-36L))