prc :: vegan

时间:2017-06-29 08:43:03

标签: r plot 3d

在传统的prc :: vegan图中,第一个rda轴被绘制为y轴,时间是x轴。 我正在尝试使用第二个rda轴作为z轴重新创建prc的3D版本。我对3D图形不是很熟悉,但我尝试使用scatterplot3D。 如果有更好的软件包以更好的方式呈现这些数据,我将不胜感激。

data(pyrifos)
week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24))
treat <- factor(rep(c("A","B","C","D"), 33))

mod <- prc(pyrifos, dose, week)
plot(mod)  #this is the traditional prc graphic

prc= rda(pyrifos ~ treat * week + Condition(week), data = pyrifos)
#this is a manual form of the prc() function

scores_1st_axis = scores(prc)$sites[, 1]
site_score_2nd_axis = scores(prc)$sites[, 2]

dat= as.data.frame(cbind(week, treat, scores_1st_axis,site_score_2nd_axis))

cols = c("#fc8d59","#007be6", "#00a42d","#b8e186")
cols = cols[as.factor(dat$treat)]
dat= cbind(cols, dat)

# How can I plot this data in 3D format? 
#preferably an interactive rotating  graphic, 
# and/or with a line running through each 'treat' over time 
# to allow for better representation and interpretation

scatterplot3d(site_scores,site_score_2nd_axis,week, color = dat$cols)

0 个答案:

没有答案