R:线框,如分类变量的 3D 图
我想开发类似线框的图,X、Y 轴上为非数字,但 Z 轴上为数字。
# mydata
set.seed(123)
yv <- rnorm(20, 10, 3)
gen <- rep(paste("G", 1:5, sep= ""), 4)
env <- c(rep(c("CA","MN","SD", "WI"), each = 5))
mdf <- data.frame(yv, gen, env)
我尝试使用网格:
require(lattice)
wireframe(yv,gen, env, data = mdf)
Error in UseMethod("wireframe") :
no applicable method for 'wireframe' applied to
an object of class "c('double', 'numeric')"
任何建议表示赞赏。
I want to develop wireframe like plot with non-numeric on X, Y axis however numeric in Z axis.
# mydata
set.seed(123)
yv <- rnorm(20, 10, 3)
gen <- rep(paste("G", 1:5, sep= ""), 4)
env <- c(rep(c("CA","MN","SD", "WI"), each = 5))
mdf <- data.frame(yv, gen, env)
I tried using lattice:
require(lattice)
wireframe(yv,gen, env, data = mdf)
Error in UseMethod("wireframe") :
no applicable method for 'wireframe' applied to
an object of class "c('double', 'numeric')"
Any suggestions appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎有效:
This appears to work:
使用lattice中函数的最简单方法是使用公式界面。
假设
yv
是您的自变量:The easiest way to use the functions in
lattice
is to use the formula interface.Assuming that
yv
is your independent variable: