@@ -454,6 +454,7 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
454
454
histtimes = times[1 : round (Int, histquantile* end )]
455
455
histmin = get (io, :histmin , low_edge (histtimes))
456
456
histmax = get (io, :histmax , high_edge (histtimes))
457
+
457
458
logbins = get (io, :logbins , nothing )
458
459
bins = bindata (histtimes, histwidth - 1 , histmin, histmax)
459
460
append! (bins, [1 , floor ((1 - histquantile) * length (times))])
@@ -466,17 +467,26 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
466
467
hist[:,end - 1 ] .= ' '
467
468
maxbin = maximum (bins)
468
469
469
- delta1 = (histmax - histmin) / (histwidth - 1 )
470
- if delta1 > 0
471
- medpos = 1 + round (Int, (histtimes[length (times) ÷ 2 ] - histmin) / delta1)
472
- avgpos = 1 + round (Int, (mean (times) - histmin) / delta1)
473
- # TODO replace with searchsortedfirst & range?
474
- q25pos = 1 + round (Int, (histtimes[max (1 ,length (times) ÷ 4 )] - histmin) / delta1)
475
- q75pos = 1 + round (Int, (histtimes[3 * length (times) ÷ 4 ] - histmin) / delta1)
476
- else
477
- medpos, avgpos = 1 , 1
478
- q25pos, q75pos = 1 , 1
479
- end
470
+ # delta1 = (histmax - histmin) / (histwidth - 1)
471
+ # if delta1 > 0
472
+ # medpos = 1 + round(Int, (histtimes[length(times) ÷ 2] - histmin) / delta1)
473
+ # avgpos = 1 + round(Int, (mean(times) - histmin) / delta1)
474
+ # # TODO replace with searchsortedfirst & range?
475
+ # q25pos = 1 + round(Int, (histtimes[max(1,length(times) ÷ 4)] - histmin) / delta1)
476
+ # q75pos = 1 + round(Int, (histtimes[3*length(times) ÷ 4] - histmin) / delta1)
477
+ # else
478
+ # medpos, avgpos = 1, 1
479
+ # q25pos, q75pos = 1, 1
480
+ # end
481
+ _centres = range (histmin, histmax, length= length (bins)- 2 )
482
+ fences = _centres .+ step (_centres)/ 2
483
+ avgpos = searchsortedfirst (fences, mean (times))
484
+ medpos = searchsortedfirst (fences, median (times))
485
+ # @show medpos medpos2
486
+ q25pos = searchsortedfirst (fences, quantile (times, 0.25 ))
487
+ q75pos = searchsortedfirst (fences, quantile (times, 0.75 ))
488
+ # @show q25pos q25pos2
489
+ # @show q75pos q75pos2
480
490
481
491
# Above the histogram bars, print markers for special ones:
482
492
printstyled (io, pad, " │ " ; color= padcolor)
@@ -485,8 +495,10 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
485
495
i > istop && break
486
496
if i == avgpos
487
497
printstyled (io, " *" , color= :green , bold= true )
488
- elseif i == medpos || (medpos== avgpos && i== medpos- 1 )
489
- # marker for "median" is moved one to the left if they collide
498
+ elseif i == medpos ||
499
+ (medpos== avgpos && i== medpos- 1 && median (times)<= mean (times)) ||
500
+ (medpos== avgpos && i== medpos+ 1 && median (times)> mean (times))
501
+ # marker for "median" is moved one to the left if they collide exactly
490
502
# printstyled(io, "½", color=:blue)
491
503
printstyled (io, " ◑" , color= :blue )
492
504
elseif i == q25pos
0 commit comments