Reputation: 21
I am doing some computation as a part of a scientific research, and I stuck up in a problem. That has to do with data visualization. I got a list of the sublists of a different length. Each of those sublists is a vector of a numeric values of the main variable for every single situation. The problem is this: is there a way to display it in a 3D plotin the following way: Let's say x-axis stands for one factor of experiment, y-axis stands for another factor of experiment, and z-axis is the axis the numerical values of our nnumeric variable. I need to display it in the way of vertical lines (that are parralel to z-axis). The number of those vertical lines is equal to the number of Factors combinations (the x-axis and y-axis). Here is the way it looked before with a smaller amount of values (when the lists were of the same size): https://www.dropbox.com/s/wdcgihjcqzobsqs/sample0.jpeg I would want to make it in the same layout, only with a bigger number of points. Each of thse sublists stands for one of those 6 situations of Factors combinations.
Or maybe there is a different way, a better way of 3D visualization of this kind of data.
And here is the list of sublists I need to make my visualization for (I do not know if this is relevant here): `> temp [[1]] [1] 395 310 235 290 240 490 270 225 430 385 170 55 295 320 270 130 300 285 130 200 225 90 205 [24] 340
[[2]] [1] 3 8
[[3]] [1] 1 0 0 0 3 2 5 2 3 5 2 3
[[4]] [1] 1 0 0 0 3 2 5 2 3 5 2 3
[[5]] [1] 1 1 1 2 3 5 2 5 3 3 3 2 3 2 3
[[6]] [1] 0 0 195 150 2 2 0 2 1 1 2 1 2 1 1 1 3 2 2 1 2 2 1 [24] 1 2 3 2 2 1 3 1 1 ` Any help/suggestions will be appreciated.
Upvotes: 1
Views: 123
Reputation: 52687
Here is an alternate visualization. Note that you don't have a 6D problem, it's really a 3D problem with 2 factor dimensions and one continuous one. There are 6 possible factor combinations. Note I had to make assumptions about what factor combination corresponds to what item in your list:
facs <- cbind(f1=rep(f1, length(f2)), f2=rep(f2, each=length(f1))) # create factor combos
lst <- list(c(395, 310, 235, 290, 240, 490, 270, 225, 430, 385, 170, 55, 295, 320, 270, 130, 300, 285, 130, 200, 225, 90, 205, 340 ), c(3, 8), c(1, 0, 0, 0, 3, 2, 5, 2, 3, 5, 2, 3), c(1, 0, 0, 0, 3, 2, 5, 2, 3, 5, 2, 3), c(1, 1, 1, 2, 3, 5, 2, 5, 3, 3, 3, 2, 3, 2, 3), c(0, 0, 195, 150, 2, 2, 0, 2, 1, 1, 2, 1, 2, 1, 1, 1, 3, 2, 2, 1, 2, 2, 1, 1, 2, 3, 2, 2, 1, 3, 1, 1))
library(data.table)
facs.dt <- as.data.table(facs)[,list(time=sort(lst[[.GRP]])), by=list(f1, f2)]
facs.dt[, id:=seq_along(time), by=list(f1, f2)]
library(ggplot2)
ggplot(facs.dt, aes(x=id, y=time)) +
geom_bar(stat="identity", position="dodge") +
scale_y_log10() + facet_grid(f1 ~ f2)
The resulting plot above displays, for each of the 6 factor combinations, the log all the time values. This makes it much easier to read the continuous variable than a 3D cube.
And an alternate view with free scales:
ggplot(facs.dt, aes(x=id, y=time)) +
geom_bar(stat="identity", position="dodge") +
facet_wrap(~ f1 + f2, scales="free") +
opts(axis.text.x=element_blank(), axis.ticks.x=element_blank())
Upvotes: 2