1
0

plot4lines_errorback.m 3.1 KB

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