I'm working with the data that represents n signals and their values in m different time moments (m ~ 1500, n ~ 50). I came up with the algorithm to check which values are representative for each signal and which are not, so I get n signals and m True/False values that tell me if the value is representative or not. I also know that True/False values are grouped pretty well, which means that if I take two close-by values, probability that they are the same is much higher, than that they are different. I'm working in R.
I want to visualize the result of this algorithm output. In order to do this I'm trying to do a raster plot, on which every point is filled with the value of the signal and every group of True/False values has a boarder that is visible. Similar to the picture below, but a bit different.
I'm also open to suggestions of other ways how to visualize this data.
I have one matrix n * m that gives me data to make a raster plot and another matrix n * m (of True/False values) that tells me which points are good/bad.
Code below is the closest I got to the answer, but there is still a boarder inside the group, which is not something that works for me.
library(ggplot2)
n = 5
m = 10
dataMatrix <- data.frame(cbind(1:m, matrix(runif(n * m), ncol = n)))
trueMatrix <- data.frame(cbind(1:m, matrix(rep(c(T, T, T, F, F), m), ncol = n)))
dataMatrix <- gather(dataMatrix, key = Signal, value = Value, -1)
trueMatrix <- gather(trueMatrix, key = TrueFalse, value = Value, -1)
dataMatrix$Representativeness <- trueMatrix$Value
dataMatrix$Signal <- as.integer(gsub("X", "", dataMatrix$Signal))
ggplot(data = dataMatrix) +
geom_raster(mapping = aes(x = X1, y = Signal, fill = Value)) +
scale_fill_gradient2(low = "blue", high = "red", na.value = "black", name = "") +
geom_rect(mapping = aes(xmin = X1 - 0.5, xmax = X1 + 0.5,
ymin = Signal - 0.5, ymax = Signal + 0.5),
size = 1, fill = NA, colour = dataMatrix$Representativeness)