Skip to content

Commit 9322ff1

Browse files
committed
Add verbosity keyword for plotting
1 parent 3a9ccf9 commit 9322ff1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ext/RxEnvironmentsPlottingExt.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ module RxEnvironmentsPlottingExt
22

33
using RxEnvironments, GLMakie, Rocket
44

5-
function RxEnvironments.animate_state(subject::AbstractEntity)
6-
@info "Animating state of $(subject)"
7-
fig = Figure()
5+
function RxEnvironments.animate_state(subject::AbstractEntity; verbose=true)
6+
if verbose
7+
@info "Animating state of $(subject)"
8+
end
9+
fig = Figure()
810
screen = display(fig)
911
actor = PlottingActor(subject, fig, screen)
1012
subscription = subscribe!(subject, actor)
@@ -18,12 +20,12 @@ struct PlottingActor <: Rocket.Actor{Any}
1820
screen
1921
end
2022

21-
function Rocket.on_next!(actor::PlottingActor, observation)
23+
function Rocket.on_next!(actor::PlottingActor, observation)
2224
empty!(actor.fig)
2325
subject = RxEnvironments.decorated(actor.entity)
2426
ax = Axis(actor.fig[1, 1])
2527
RxEnvironments.plot_state(ax, subject)
26-
end
28+
end
2729

2830
function Rocket.on_complete!(actor::PlottingActor)
2931
GLMakie.destroy!(actor.screen)

0 commit comments

Comments
 (0)