Skip to content

Commit

Permalink
fix error bar range in recipes (#3179)
Browse files Browse the repository at this point in the history
* fix error bar range in recipes

* point_iterator instead of data_limits

* NEWS

* hexbin point iterator

* bracket
  • Loading branch information
palday committed Aug 25, 2023
1 parent a4af178 commit b9f25b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -2,6 +2,8 @@

## master

- Fixed regression in determining axis limits [#3179](https://github.com/MakieOrg/Makie.jl/pull/3179)

## v0.19.8

- Improved CairoMakie rendering of `lines` with repeating colors in an array [#3141](https://github.com/MakieOrg/Makie.jl/pull/3141).
Expand Down
8 changes: 4 additions & 4 deletions src/basic_recipes/bracket.jl
Expand Up @@ -54,7 +54,7 @@ function Makie.plot!(pl::Bracket)
return to === automatic ? Float32.(0.75 .* fs) : Float32.(to)
end

onany(pl, points, scene.camera.projectionview, pl.model, transform_func(pl),
onany(pl, points, scene.camera.projectionview, pl.model, transform_func(pl),
scene.px_area, pl.offset, pl.width, pl.orientation, realtextoffset,
pl.style) do points, _, _, _, _, offset, width, orientation, textoff, style

Expand Down Expand Up @@ -108,16 +108,16 @@ function Makie.plot!(pl::Bracket)
end

# Avoid scale!() / translate!() / rotate!() to affect these
series!(pl, bp; space = :pixel, solid_color = pl.color, linewidth = pl.linewidth,
series!(pl, bp; space = :pixel, solid_color = pl.color, linewidth = pl.linewidth,
linestyle = pl.linestyle, transformation = Transformation())
text!(pl, textpoints, text = texts, space = :pixel, align = pl.align, offset = textoffset_vec,
fontsize = pl.fontsize, font = pl.font, rotation = autorotations, color = pl.textcolor,
justification = pl.justification, model = Mat4f(I))
pl
end

data_limits(pl::Bracket) = mapreduce(union, pl[1][]) do points
Rect3f([points...])
function point_iterator(pl::Bracket)
point_iterator(pl.plots[1])
end

bracket_bezierpath(style::Symbol, args...) = bracket_bezierpath(Val(style), args...)
Expand Down
4 changes: 2 additions & 2 deletions src/basic_recipes/error_and_rangebars.jl
Expand Up @@ -280,6 +280,6 @@ function screen_to_plot(plot, p::VecTypes)
end

# ignore whiskers when determining data limits
function data_limits(bars::Union{Errorbars, Rangebars})
data_limits(bars.plots[1])
function point_iterator(bars::Union{Errorbars, Rangebars})
point_iterator(bars.plots[1])
end
4 changes: 2 additions & 2 deletions src/stats/hexbin.jl
Expand Up @@ -62,7 +62,7 @@ end

Makie.conversion_trait(::Type{<:Hexbin}) = PointBased()

function data_limits(hb::Hexbin)
function point_iterator(hb::Hexbin)
bb = Rect3f(hb.plots[1][1][])
fn(num::Real) = Float32(num)
fn(tup::Union{Tuple,Vec2}) = Vec2f(tup...)
Expand All @@ -71,7 +71,7 @@ function data_limits(hb::Hexbin)
nw = widths(bb) .+ (ms..., 0.0f0)
no = bb.origin .- ((ms ./ 2.0f0)..., 0.0f0)

return Rect3f(no, nw)
return decompose(Point2f, Rect3f(no, nw))
end

get_weight(weights, i) = Float64(weights[i])
Expand Down

0 comments on commit b9f25b9

Please sign in to comment.