Is it possible to define an in-place plotting recipe using Makie? For example, the following recipe works properly.
using Makie
@recipe(MyPlot, x, y) do scene
Attributes(
plot_color = :red,
)
end
function AbstractPlotting.plot!(myplot::MyPlot)
data = rand(10)
lines!(myplot, data, color=myplot.plot_color)
scatter!(myplot, data, color=myplot.plot_color)
myplot
end
fig = Figure()
myplot(fig[1, 1], rand(10), rand(10), plot_color=:black)
The problem is that when I execute the last statement again, like,
myplot(fig[1, 1], rand(10), rand(10), plot_color=:green)
I get the following error
ERROR: AssertionError: isempty(contents(fp.gp, exact = true))
Stacktrace:
[1] plot(::Type{Combined{myplot, ArgType} where ArgType}, ::AbstractPlotting.FigurePosition, ::Vector{Float64}, ::Vararg{Vector{Float64}, N} where N; axis::NamedTuple{(), Tuple{}}, kwargs::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:plot_color,), Tuple{Symbol}}})
@ AbstractPlotting ~/.julia/packages/AbstractPlotting/50gu0/src/figureplotting.jl:44
[2] myplot(::AbstractPlotting.FigurePosition, ::Vararg{Any, N} where N; attributes::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:plot_color,), Tuple{Symbol}}})
@ Main ~/.julia/packages/AbstractPlotting/50gu0/src/recipes.jl:12
[3] top-level scope
@ REPL[43]:1
[4] eval
@ ./boot.jl:360 [inlined]
Is there a possible solution for this?