Reputation: 1797
I am trying to create a chart as per image below in R. I have a basic straightforward matrix with locations and values over time, and would like to plot them as per below. I recognize that one could offset / shift each value manually vertically and horizontally for consecutive rows, but was hoping there is an existing package / graphical option to plot these graphs directly from the matrix. Help much appreciated, W
Upvotes: 1
Views: 1319
Reputation: 263332
mat <- sapply(-10:10, function(mean) dnorm(seq(-20,20,len=210), mean))+
sapply(rep(0,21), function(mean) dnorm(seq(-20,20,len=210), mean))
matplot(seq(-20,20,len=210), mat, type="n", ylim=c(0,1.5))
matlines(seq(-20,20,len=210), mat+rep( seq(0,1, len=21), each=210), lty=1,col=1)
Upvotes: 4