user1885116
user1885116

Reputation: 1797

R 3D line chart

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

enter image description here

Upvotes: 1

Views: 1319

Answers (1)

IRTFM
IRTFM

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)

enter image description here

Upvotes: 4

Related Questions