5
$\begingroup$

I have two datasets in the form of $q \times k$ matrices (variables $x$ and $y$). Both variables differ (lets assume that they differ by a constant). Columns of the matrices are subsequent points in time, rows are observations (sample quantiles). The problem is to visualize those two variables to show differences between them and their variances across the time. The raw data is available. Plot needs to be readable to lay persons.

Below I paste the synthetic data that can serve as illustration.

set.seed(123)
mu <- 0
n <- 1000
k <- 10
q <- 10
x <- matrix(NA, q, k)
y <- matrix(NA, q, k)

for (i in 1:k) {
  x[, i] <- quantile(rnorm(n, mu[i], 1), c(seq(0, 1, by=.1)-.05)[-1])
  y[, i] <- quantile(rnorm(n, mu[i]+1.5, 1), c(seq(0, 1, by=.1)-.05)[-1])
  mu[i+1] <- mu[i] + runif(1, -1, 1)
}

Do you have any ideas how could it be visualized?

$\endgroup$

2 Answers 2

6
$\begingroup$

Something like these quartile bands may work. You can add more quantiles if more detail is needed, but sometimes less is more. The quartiles will be enough to get a sense of the spread and the skewness.

The downside is that the bands don't overlay well, so you lose direct comparison. I added a reference band around 0 to help compare the two frames.

enter image description here

$\endgroup$
6
$\begingroup$

Let's take $x$ first. Use the quantiles to construct a smooth distribution $x_j(\cdot)$ at each timestep $j$. Pick a 1D grid of values $a + bi$. Now plot the greyscale image $x_j(a+bi)$, where $i$ is the row coordinate and $j$ is the column coordinate, and the $x$-values are normalized to 0-255.

Now do the same for $y$, and put the plots one above the other. If you'd prefer to combine them, then plot $x$ in the red channel and $y$ in the blue. If you do that though, do some reading on the perception of color first. Rainbow Color Map (Still) Considered Harmful is a nice summary of the problems you can encounter.

e: Actually, if you do the two plots independently, plot them in greens rather than greys. It's much easier to pick out a very light green than it is a very light grey.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.