plot4lines_2nd.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. function plot4lines_2nd(time,a,colores,xl,yl,legend1,legend2,legend3,legend4,titu,simple,legtitles,addingcluster,timesignclust,coloresclus)
  2. a_plot(8)=fill([0 350 0 350],[20 20 0 0],'k','LineStyle','none','FaceAlpha',0.2); hold on;
  3. % a_plot(9)=fill([0 350 0 350],[20 20 0 0],'k','LineStyle','none','FaceAlpha',0.0);
  4. % a_plot(10)=fill([0 350 0 350],[20 20 0 0],'k','LineStyle','none','FaceAlpha',0.0);
  5. for pl=[4 3 2 1];
  6. dia_acc=a{pl}
  7. % timetoplot=time(150:end);
  8. timetoplot=time(1:end);
  9. mean_da=nanmean(dia_acc(1:end,:),2);
  10. sem_da=nanstd(dia_acc(1:end,:),0,2)/sqrt(sum(~isnan(dia_acc(1,:))));
  11. line([timetoplot(1),timetoplot(end)], [0,0], 'Color', 'k','LineStyle','-','LineWidth',2);hold on;
  12. % line([timetoplot(1),timetoplot(end)], [chancelevel,chancelevel], 'Color', 'k','LineStyle','--');hold on;
  13. a_plot(pl)=plot(timetoplot,mean_da,'Color',colores(pl,:),'LineWidth',3);hold on;
  14. fill([timetoplot,flipdim(timetoplot,2),timetoplot(1)],[mean_da+sem_da;flipdim(mean_da-sem_da,1);mean_da(1)+sem_da(1)],colores(pl,:),'LineStyle','none','FaceAlpha',0.30);
  15. hold on
  16. end
  17. % a_plot(5)=line([0,0],[-10 10], 'Color', 'k','LineStyle','--','LineWidth',2);hold on;
  18. % a_plot(6)=line([1000,1000],[-10 10], 'Color', 'k','LineStyle','-.');hold on;
  19. % a_plot(7)=line([2000,2000],[-10 10], 'Color', 'k','LineStyle','--');hold on;
  20. %%
  21. if addingcluster
  22. % Adding lines of cluster perm test
  23. strp=-0.01;
  24. dist=0.0075;
  25. for lll=1:4
  26. clustertoplot=nan(size(time))
  27. t1=find(time==timesignclust(lll,1))
  28. t2=find((time==timesignclust(lll,2)))
  29. clustertoplot(t1:t2)=strp-dist*lll
  30. hold on;
  31. a_plot(10+lll)=plot(time,clustertoplot,'o',...
  32. 'MarkerSize',5,...
  33. 'MarkerEdgeColor',coloresclus(lll,:),...
  34. 'MarkerFaceColor',coloresclus(lll,:))
  35. legend('off')
  36. end
  37. end
  38. if simple==0
  39. legend([a_plot(1 ) a_plot(2) a_plot(3) a_plot(4) a_plot(5)],...
  40. legend1,legend2,legend3,legend4,'retro-cue onset','object 2 onset','retrocue onset','Location','best')
  41. elseif simple==1
  42. if legtitles==0
  43. legend([a_plot(1 ) a_plot(2) a_plot(3) a_plot(4)],...
  44. legend1,legend2,legend3,legend4,'Location','best')
  45. elseif legtitles==1
  46. lgd= legend([a_plot(1 ) a_plot(2) a_plot(3) a_plot(4)],...
  47. legend1,legend2,legend3,legend4,'Position',[260 100 0 350])
  48. lgd.NumColumns = 2;
  49. text(122,250,'Stimulus 1','Color','black','FontSize',14,'Units','pixel','HorizontalAlignment','center','FontSize',20,'FontWeight','bold')
  50. text(237,250,'Stimulus 2','Color','black','FontSize',14,'Units','pixel','HorizontalAlignment','center','FontSize',20,'FontWeight','bold')
  51. end
  52. end
  53. legend('boxoff')
  54. title([titu])
  55. xlim(xl)
  56. ylim(yl)
  57. xlabel('time (ms) from Cue 2')
  58. ylabel('rho')
  59. set(gca, 'box', 'off')
  60. end