Skip to content

Commit

Permalink
Merge pull request #121 from rafaqz/bugfix
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
rafaqz authored Apr 10, 2020
2 parents a8ca876 + 54ad272 commit e5e0cd5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))

20 changes: 17 additions & 3 deletions src/selector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e5e0cd5

Please sign in to comment.