第二个是十六进制图如果你的 (x,y) 对是唯一的,你可以做一个 xy 图,如果这是你想要的,你可以尝试使用基本 R 绘图函数:
x <- runif(100)
y<-runif(100)
time<-runif(100)
pal <- colorRampPalette(c('white','black'))
#cut creates 10 breaks and classify all the values in the time vector in
#one of the breaks, each of these values is then indexed by a color in the
#pal colorRampPalette.
cols <- pal(10)[as.numeric(cut(time,breaks = 10))]
#plot(x,y) creates the plot, pch sets the symbol to use and col the color
of the points
plot(x,y,pch=19,col = cols)
使用 ggplot,您还可以尝试:
library(ggplot2)
qplot(x,y,color=time)