【发布时间】:2014-10-03 14:36:57
【问题描述】:
我有以下数据:
#means and SEs
s2humanlikem<-c(1.895,1.658,2.684,2.421,2.921,2.158,3.632,2.737,4.526,4.105)
s2humanlikese<-c(.199,.157,.250,.234,.243,.225,.197,.235,.145,.180)
s2agent<-c("Software","Software","Machine","Machine","Robot","Robot","Android","Android","Human","Human")
Story<-c("Cooperative","Self-interested")
#combine into dataframe
hri2<-data.frame(s2agent,s2humanlikem,s2humanlikese,Story)
#make numeric and factor
hri2$s2agent <- factor(hri2$s2agent, levels = c("Software","Machine", "Robot", "Android","Human"))
hri2$s2humanlikem<-as.numeric(levels(hri2$s2humanlikem))[hri2$s2humanlikem]
hri2$s2humanlikese<-as.numeric(levels(hri2$s2humanlikese))[hri2$s2humanlikese]
我正在尝试使用以下代码进行绘图:
ggplot(hri2,aes(x=s2agent,y=s2humanlikem,group=Story)) +
stat_smooth(aes(x=seq(length((s2agent)))),se=F,method="lm",formula=y~poly(x,4)) +
scale_x_continuous(breaks=seq(length(unique(hri2$s2agent))),labels=levels(hri2$s2agent))
但是,如您所见,图表的坐标轴很不稳定。由于某种原因,这两条线也未对齐,我不知道为什么。对此的任何帮助将不胜感激。
感谢您的关注!
【问题讨论】: