Skip to content

Commit

Permalink
remove unnecessary figure state updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel committed Oct 3, 2024
1 parent b907141 commit 3e4452c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
7 changes: 0 additions & 7 deletions docs/src/examples/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ using PalmerPenguins, DataFrames
penguins = dropmissing(DataFrame(PalmerPenguins.load()))

f = data(penguins) * mapping(:species, :bill_depth_mm, color=:sex) * visual(Beeswarm) |> draw
Makie.update_state_before_display!(f.figure)
Makie.update_state_before_display!(f.figure)
Makie.update_state_before_display!(f.figure)
f

# ## SwarmMakie logo
Expand All @@ -43,10 +40,6 @@ f.scene.backgroundcolor[] = RGBAf(1,1,1,0)
a.scene.backgroundcolor[] = RGBAf(1,1,1,0)
hidedecorations!(a)
hidespines!(a)
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
f

# ## Wilkinson's dot histogram
Expand Down
9 changes: 2 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ buffer = deepcopy(pixel_points)
hidedecorations!(a)
hidespines!(a)
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
img = Makie.colorbuffer(f.scene; px_per_unit = 1, pt_per_unit = 1, antialias = :none, visible = true, start_renderloop = false)
# We have a matrix of all colors in the image. Now, what we do is the following:
# The color white in RGBf is (1, 1, 1). For a color to be red, the blue and green components
Expand All @@ -53,16 +51,13 @@ buffer = deepcopy(pixel_points)
# First, we test the regular gutter with multiple categories.
f, a, p = beeswarm(rand(1:3, 300), randn(300); color = rand(RGBAf, 300), markersize = 20, algorithm = SimpleBeeswarm())
Makie.update_state_before_display!(f)
Makie.update_state_before_display!(f)
@test_warn "Gutter threshold exceeded" p.gutter = 0.2
# Next, we test it in direction y
f, a, p = beeswarm(rand(1:3, 300), randn(300); direction = :x, color = rand(RGBAf, 300), markersize = 20, algorithm = SimpleBeeswarm())
Makie.update_state_before_display!(f)
f, a, p = beeswarm(rand(1:3, 300), randn(300); direction = :x, color = rand(RGBAf, 300), markersize = 20, algorithm = SimpleBeeswarm())
Makie.update_state_before_display!(f)
@test_warn "Gutter threshold exceeded" p.gutter = 0.2
# and it shouldn't warn if, when using a lower markersize, the gutter is not reached.
f, a, p = beeswarm(rand(1:3, 300), randn(300); direction = :y, color = rand(RGBAf, 300), markersize = 9, algorithm = SimpleBeeswarm())
Makie.update_state_before_display!(f)
f, a, p = beeswarm(rand(1:3, 300), randn(300); direction = :y, color = rand(RGBAf, 300), markersize = 9, algorithm = SimpleBeeswarm())
Makie.update_state_before_display!(f)
@test_nowarn p.gutter = 0.5
end
Expand Down

0 comments on commit 3e4452c

Please sign in to comment.