@@ -578,7 +578,11 @@ def peri_event_time_histogram(
578
578
else :
579
579
bars = np .zeros_like (mean )
580
580
if error_bars != 'none' :
581
- ax .fill_between (peths .tscale , mean - bars , mean + bars , ** errbar_kwargs )
581
+ negative_bar = mean - bars
582
+ if np .any (negative_bar < 0 ):
583
+ ax .fill_between (peths .tscale , 0 , mean + bars , ** errbar_kwargs )
584
+ else :
585
+ ax .fill_between (peths .tscale , negative_bar , mean + bars , ** errbar_kwargs )
582
586
583
587
# Plot the event marker line. Extends to 5% higher than max value of means plus any error bar.
584
588
plot_edge = (mean .max () + bars [mean .argmax ()]) * 1.05
@@ -588,6 +592,13 @@ def peri_event_time_histogram(
588
592
# blank space below the zero where the raster will go.
589
593
ax .set_xlim ([- t_before , t_after ])
590
594
ax .set_ylim ([- plot_edge if include_raster else 0. , plot_edge ])
595
+ if int (plot_edge )== 0 :
596
+ include_raster = False
597
+
598
+ if mean .min ()!= 0 :
599
+ ax .set_yticks (0 ,mean .min (),mean .max ())
600
+ else :
601
+ ax .set_yticks ([0 ,mean .max ()])
591
602
# Put y ticks only at min, max, and zero
592
603
if mean .min () != 0 :
593
604
ax .set_yticks ([0 , mean .min (), mean .max ()])
0 commit comments