r - Huge amount of data graphical representation -
i have large data.frame (ncols = 500, nrows = 14000). looks this:
sample1 sample2 sample3 ..... gene1 22 0 0.11 ..... gene2 0.112 0.1 0.4 ..... gene3 0.45 0 0.19 ..... ..... ..... ..... ..... .....
i plot such huge amount of data without applying statistic clear (simply using colors or other tools) difference in terms of of numbers (magnitude) ex. between gene1 , gene2 sample 1 , on. idea apart heatmap?
how using geom_raster
ggplot2?
# make data set.seed(1) df <- data.frame( matrix( runif(25) , 5 , 5 ) ) # x1 x2 x3 x4 x5 #1 0.5316382 0.4360309 0.09576886 0.56497254 0.43930824 #2 0.2383700 0.1531009 0.71377161 0.39367645 0.42211072 #3 0.5009796 0.6549886 0.05996069 0.08236798 0.08574704 #4 0.1171437 0.8765644 0.29892712 0.06071803 0.78011966 #5 0.5066046 0.5486397 0.34770099 0.07785835 0.09659246 # abs difference between columns of dataframe out <- data.frame( t( apply( df , 1 , function(x) abs( diff( x ) ) ) ) ) # plot using geom_raster require( ggplot2 ) require( reshape2 ) out.melt <- melt( out ) out.melt$y <- rep( 1:10,times = 9 ) p <- ggplot( out.melt , aes( variable , y , fill = value ) ) + geom_raster() p
Comments
Post a Comment