I've got a large dataset of a time series that I'd like to plot with lines indicating values across the time points. Example:
我有一个时间序列的大型数据集,我想绘制的线条表示时间点的值。例:
df.test=data.frame(runif(1000),runif(1000),runif(1000)*2,runif(1000)/2)
matplot(t(df.test),type="l",col="black")
I would like to do something analogous to smoothScatter
to illustrate the density of the overlap of lines across the time points (e.g. where multiple lines overlap, the colors will change from black to red), but have been unable to make anything work to that effect.
我想做类似于smoothScatter的事情,以说明时间点上线条重叠的密度(例如,多条线重叠,颜色将从黑色变为红色),但是无法使任何效果发挥作用。
Does anyone know of a function/package than can do this or something similar?
有没有人知道一个函数/包比这样做或类似的东西?
Thanks in advance!
提前致谢!
1 个解决方案
#1
1
I think you can get such effects by overlapping alpha red to black. (But I feel the output one alpha color makes is cool)
我认为你可以通过将alpha红色重叠为黑色来获得这样的效果。 (但我觉得输出一个alpha颜色很酷)
set.seed(1); df.test = data.frame(runif(1000), runif(1000), runif(1000)*2, runif(1000)/2)
matplot(t(df.test), type = "l", col = "black")
matplot(t(df.test), type = "l", col = ggplot2::alpha("red", 0.1), add=T)
matplot(t(df.test), type = "l", col = ggplot2::alpha("black", 0.2))
#1
1
I think you can get such effects by overlapping alpha red to black. (But I feel the output one alpha color makes is cool)
我认为你可以通过将alpha红色重叠为黑色来获得这样的效果。 (但我觉得输出一个alpha颜色很酷)
set.seed(1); df.test = data.frame(runif(1000), runif(1000), runif(1000)*2, runif(1000)/2)
matplot(t(df.test), type = "l", col = "black")
matplot(t(df.test), type = "l", col = ggplot2::alpha("red", 0.1), add=T)
matplot(t(df.test), type = "l", col = ggplot2::alpha("black", 0.2))