I've 3 variables, for a set of genes - the log2FC, the log2(basemeanB) and the difference in expression of a gene in fraction of cells. below are my vectors -
df <- data.frame(Genes=c('ADCYAP1R’, ‘GRM1’, ‘GRM3’, ‘HTR1F’, ‘HTR2A’, ‘MCHR2’, ‘RXFP1’), Log2FC=c(-2.299, 0.52, 2.439, 1.783, 2.459, 5.196, 4.071))
df2 <- data.frame(Genes=c('ADCYAP1R’, ‘GRM1’, ‘GRM3’, ‘HTR1F’, ‘HTR2A’, ‘MCHR2’, ‘RXFP1’), grad=c(7.20, 7.79, 6.45, 7.43, 5.79, 0.79, 5.48))
df3 <- data.frame(Genes=c('ADCYAP1R’, ‘GRM1’, ‘GRM3’, ‘HTR1F’, ‘HTR2A’, ‘MCHR2’, ‘RXFP1’), beta=c(0.283, 0.35, 0.405, 0.451, 0.594, 0.523, 0.65))
I want a gradient bar plot with the height of the bar from the 1st vector, the gradient from the 2nd vector and the points on the bar from the 3rd vector.
I was following the below code, but i'm not able to get the output i want.
p <- ggplot(df, aes(x=Genes, y=Log2FC))
p <- p + geom_bar(stat = "identity", aes(fill = Log2FC)) + scale_fill_gradient2(low='plum1', mid='plum', high='plum4')
p + geom_point(data=df3, aes(x=as.numeric(Genes), y=total), colour = "blue", shape = 15, size = 3) + scale_y_continuous(sec.axis = sec_axis(~./3, name = "Beta Value"))
can anyone please help me?
Your code contains stylized single quotes mixed in with regular ASCII single quotes. This could result in unexpected errors. Please make sure that your code only has ASCII characters.
should be