3

私はまったくの初心者Rです。これがすでに何億回も尋ねられている場合は、ご容赦ください。私はこのheatmapに従って、を使用して作成しようとしています。Rtsvs

これは一例です。

name sam1 sam2
a     0.2  0
b     0.1  0.05
c     0.3  0.06

申し訳ありませんが、取得したグラフを投稿できません(初心者のため)。

When the graph is made the scale is between 0 to 1 (the data is rescaled between 0 to 1 in heatmap), however I do not have any values bigger than 0.3 in my files, hence I want to know if it is possible to have a scale between 0 to 0.3 in heatmap. I am not sure if I am providing enough details here, please let me know if I need to put in some more details here.

basically I am using

a <- read.table(file = "name", sep ="\t", header =T) 

a.m <- melt(a)

a.m <- ddply(a.m, .(variable), transform,  rescale = rescale(value))

(p <- ggplot(a.m, aes(variable, transposons)) + 
      geom_tile(aes(fill = rescale), colour = "yellow") + 
      scale_fill_gradient(low = "yellow",  high = "darkgreen"))

Any help is most appreciated, thanks in advance.

4

1 に答える 1

3

デフォルトでは、?rescale

    rescale(x, to = c(0, 1), from = range(x, na.rm = TRUE))

そのため、値は 0 と 1 の間にあります。最小値と最大値を指定するだけです。rescale

a.m <- ddply(a.m, .(variable), transform,  
                    rescale = rescale(value,to=c(0,0.3))))
于 2012-12-24T09:09:55.133 に答える