Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #121

Merged
merged 2 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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