【发布时间】:2017-03-23 16:42:06
【问题描述】:
iFacColName <- "hireMonth"
iTargetColName <- "attrition"
iFacVector <- as.factor(c(1,1,1,1,10,1,1,1,12,9,9,1,10,12,1,9,5))
iTargetVector <- as.factor(c(1,1,0,1,1,0,0,1,1,0,1,0,1,1,1,1,1))
sp <- spineplot(iFacVector,iTargetVector,xlab=iFacColName,ylab=iTargetColName,main=paste0(iFacColName," vs. ",iTargetColName," Spineplot"))
spLabelPass <- sp[,2]/(sp[,1]+sp[,2])
spLabelFail <- 1-spLabelPass
text(seq_len(nrow(sp)),rep(.95,length(spLabelPass)),labels=as.character(spLabelPass),cex=.8)
出于某种原因,text() 函数仅在图形右侧绘制一个标签。我已经使用这种格式将数据标签应用于其他类型的图表,所以我很困惑。
编辑:添加更多代码以使示例工作
【问题讨论】:
-
什么是 iFacColName 和 iTargetColName?
-
抱歉,修改了代码