将3个单独的线图组合成一个线图显示

时间:2017-09-27 19:39:38

标签: r plot ggplot2

我们正在研究模式识别和制作不同的变量

| RN |      A |     B |            C |
|----|--------|-------|--------------|
|  1 | 199901 |  3.81 |        51905 |
|  2 | 199902 | -6.09 |   48743.9855 |
|  3 | 199903 |  4.75 | 51059.324811 |
|  4 | 199904 |  6.39 | 54322.015666 |
|  5 | 199905 | -2.35 | 53045.448298 |
|  6 | 199906 |  2.65 | 54451.152678 |
|  7 | 199907 |   1.1 | 55050.115357 |
|  8 | 199908 | -1.45 | 54251.888684 |
|  9 | 199909 |     0 | 54251.888684 |
| 10 | 199910 |  4.37 | 56622.696219 |

对Respone Times结果进行实际ANOVA的代码

unusualsubjects <- rtaverages$subject_id[rtaverages$count < 5] # make a list of subjects without enough data.
rtaverages <- filter(rtaverages,!(subject_id %in% unusualsubjects)) # only include data from good subjects.  ! = not.  Put data from acceptable subjects right back in the same data frame
# Another example of filtering subjects: let's say we only wanted to analyze subjects with accuracies over 95%
accurateSubjects <- averages$subject_id[averages$accuracy > .95] #returns all of the subject_ids for subjects meeting an accuracy criterion 
length(accurateSubjects) # tells us how many accurate subjects there are
goodSubjectdata<-filter(data,subject_id %in% accurateSubjects) # make a new data frame that contains only the data from accurate subjects

目前正尝试以下列方式将3条线放到一个地块上:

model<ezANOVA(data=Data,dv=rt,within=c(set_size,target_presence,task),wid=subject_id) # You need to fill in the XXXs with the correct variable names within the variable containing all of the correct RTs.  conduct a repeated measures ANOVA - dv = dependent variable.  within = a list of all of the within subject variables.  wid = variable that is used to group data by subject
model # show results of the ANOVA model
table1 <- tapply(X=Data$rt,INDEX=list(Data$task,Data$set_size),FUN=mean,trim=0.1)#find breakdown just of setsize and task - less broken down than the above tapply code, obtained just by deleting one item from the INDEX list "INDEX=list(rtaverages$target_presence,rtaverages$set_size,rtaverages$task)" above
table1 #show means so that one can begin to interpret the data.  You'll break down rtaverages in different ways to get the different mean RTs that you need for your report

par(mar = c(4,4,4,0),mfrow=c(1, 2) ) # mfrow=c(1,2) creates two plots side by side
lineplot.CI(data=filter(rtaverages,task=="conjunctive"),x.factor=set_size,group=target_presence,x.cont=TRUE,response=rt,ylim=c(0,4000),x.leg=2,xlab="Conjunctive Set Size",ylab="RT") # produces a line graph with confidence intervals    
lineplot.CI(data=filter(rtaverages,task=="disjunctive"),x.factor=set_size,group=target_presence,x.cont=TRUE,response=rt,ylim=c(0,4000),x.leg=2,xlab="Disjunctive Set Size",ylab="RT") # produces a line graph with confidence intervals    

我让它们结合起来,但现在线条丢失了它们的格式:

plot

0 个答案:

没有答案