I am currently generating heatmaps in R using the ggplot function. In the code below. First, I read the data in the data framework, deleted any duplicate rows, changed the timestamp of the field, melted the data frame (according to the โtimestampโ), scaled the entire variable from 0 to 1, and then drew a heat map.
In the resulting heatmap, time is displayed along the x axis, and each iostat-sda variable (see examples of data below) is displayed along the y axis. Note. If you want to try the R code, you can paste the example data below into a file called iostat-sda.csv.
however, I really need to be able to group the rows in this heatmap ... does anyone know how this can be achieved with the ggplot function?
Any help would be greatly appreciated!
The code library(ggplot2) fileToAnalyse_f <- read.csv(file="iostat-sda.csv",head=TRUE,sep=",") fileToAnalyse <- subset(fileToAnalyse, !duplicated(timestamp)) fileToAnalyse[,1]<-factor(fileToAnalyse[,1]) fileToAnalyse.m <- melt(fileToAnalyse, id=1) fileToAnalyse.s <- ddply(fileToAnalyse.m, .(variable), transform, rescale = rescale(value) )
source share