English 中文(简体)
在一个地块中采用多种尺度—— 颜色-不同数据范围的梯度
原标题:Using multiple scale_colour_gradient scales for different ranges of the data in one plot
  • 时间:2012-04-13 13:55:06
  •  标签:
  • r
  • ggplot2

如果我的问题不明确的话,请与我一起谈谈我。

a. 具有<代码>数据。

1.protein_name, 2.protein_FC, 3.protein_pval, 4.mfar_FC, 5.mfar_pval and 6.freq.

我试图用X=log2(protein_FC)和N=log10(protein_pval)策划火山。 然后,将狗的大小绘制成fr和颜色,以至RNA。 这是所有工作罚款,这里是我使用的法典:

ggplot( protein [ which ( protein$freq <= 0.05 ),] , aes( x = log2( protein_FC ) ,
       y = -log10 ( protein_pval ) , size = freq , colour = mRNA_FC , 
       label = paste(protein_name,",",mRNA_pval), alpha=1/1000)) + 
  geom_point() + geom_text( hjust = 0 , vjust = 0 , colour = "black" , size = 2.5 ) + 
  geom_abline( intercept = 1.3 , slope = 0) + 
  scale_colour_gradient(limits=c(-3,3))

直到此为止。 但是,由于试验的性质,其数据在mfar_FC = 0上相当密集。 当时,假冒的彩色计划在区别不同点方面非常适用。

我利用<代码>low=“colour1”和high=“colour2”,尝试了各种彩色比额表。 然而,我认为,最好在<条码>mfar_FC的幅度范围内使用多种彩票,即像样。 Blue to White for -3<mfar<-0.2, Red to White for -0.2<mfar_FC<0, Green to White for 0<mfar_FC<0.2;mfar_FC<3。

但我无意找到这样做的任何方法。

Any help would be appreciated. Cheers!

最佳回答

您希望使用<条码>>标准_gradientn>。 例如:

library(ggplot2)

x = seq(-0.1, 0.1, len=100)
y = 0:10
dat = expand.grid(x=x, y=y)

ggplot(data=dat, aes(x=x, y=y, fill=x)) +
  geom_raster() +
  scale_fill_gradientn(colours=c( red ,  yellow ,  cyan ,  blue ),
    values   = c(-0.05,-1e-32,1e-32,0.05),
    breaks   = c(-0.05,-0.005,0.005,0.05),
    rescaler = function(x,...) x,
    oob      = identity)

“enterography

问题回答

暂无回答




相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签