From 140095a3f3bada0ab067a68eb710b85093af7a89 Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Sat, 11 Apr 2020 00:52:22 +1000 Subject: [PATCH 1/2] fix plot labels --- src/plotrecipes.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plotrecipes.jl b/src/plotrecipes.jl index 4299453f5..65f26ea1c 100644 --- a/src/plotrecipes.jl +++ b/src/plotrecipes.jl @@ -106,7 +106,14 @@ end refdims_title(A::AbstractArray) = join(map(refdims_title, refdims(A)), ", ") refdims_title(dim::Dimension) = string(name(dim), ": ", refdims_title(mode(dim), dim)) -refdims_title(mode::AbstractSampled, dim::Dimension) = - ((start, stop) = bounds(dim); "$start to $stop") -refdims_title(mode, dim::Dimension) = val(dim) +refdims_title(mode::AbstractSampled, dim::Dimension) = begin + start, stop = map(string, bounds(dim)) + println("bounds: ", bounds(dim)) + if start == stop + start + else + "$start to $stop" + end +end +refdims_title(mode::IndexMode, dim::Dimension) = string(val(dim)) From 54ad272e081b6b9fb826682375cd4b07faca5b94 Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Sat, 11 Apr 2020 00:53:04 +1000 Subject: [PATCH 2/2] temp fix for Irregular Interval between methods --- src/selector.jl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/selector.jl b/src/selector.jl index f0147ef34..d43314c48 100644 --- a/src/selector.jl +++ b/src/selector.jl @@ -349,19 +349,33 @@ between(indexord::Reverse, ::Points, dim::Dimension, sel) = begin relate(dim, a:b) end between(indexord, s::Intervals, dim::Dimension, sel) = - between(span(mode(dim)), indexord, s, dim, sel) -between(span::Regular, indexord::Forward, ::Intervals, dim::Dimension, sel) = begin + between(span(mode(dim)), indexord, dim, sel) +between(span::Regular, indexord::Forward, dim::Dimension, sel) = begin low, high = _sorttuple(sel) .+ _locus_adjustment(mode(dim), span) a = _inbounds(_searchfirst(dim, low), dim) b = _inbounds(_searchlast(dim, high), dim) relate(dim, a:b) end -between(span::Regular, indexord::Reverse, ::Intervals, dim::Dimension, sel) = begin +between(span::Regular, indexord::Reverse, dim::Dimension, sel) = begin low, high = _sorttuple(sel) .+ _locus_adjustment(mode(dim), span) a = _inbounds(_searchfirst(dim, high), dim) b = _inbounds(_searchlast(dim, low), dim) relate(dim, a:b) end +# TODO do this properly. +# The intervals need to be between the selection, not the points. +between(span::Irregular, indexord::Forward, dim::Dimension, sel) = begin + low, high = _sorttuple(sel) + a = _inbounds(_searchfirst(dim, low), dim) + b = _inbounds(_searchlast(dim, high), dim) + relate(dim, a:b) +end +between(span::Irregular, indexord::Reverse, dim::Dimension, sel) = begin + low, high = _sorttuple(sel) + a = _inbounds(_searchlast(dim, high), dim) + b = _inbounds(_searchfirst(dim, low), dim) + relate(dim, a:b) +end # Reverse index needs to use rev=true and lt=<= for searchsorted # so that it is exactly the revsese of a forward index