diff --git a/content/2.reference/3.reactive-UI/2.plotting.md b/content/2.reference/3.reactive-UI/2.plotting.md index 138693c..04cafaa 100644 --- a/content/2.reference/3.reactive-UI/2.plotting.md +++ b/content/2.reference/3.reactive-UI/2.plotting.md @@ -66,18 +66,7 @@ or with the `plotly` tag in the HTML code ### Defining plots from Plots.jl It is also possible to obtain the `plotdata` from a plot defined with -[Plots.jl](https://docs.juliaplots.org/stable/) using the PlotlyJS backend and the following function: -```julia -import PlotlyBase -function plotly_traces(plt::Plots.Plot) - traces = PlotlyBase.GenericTrace[] - for series_dict in Plots.plotly_series(plt) - plotly_type = pop!(series_dict, :type) - push!(traces, PlotlyBase.GenericTrace(plotly_type; series_dict...)) - end - return traces -end -``` +[Plots.jl](https://docs.juliaplots.org/stable/) using the PlotlyJS backend and the `Plots.plotly_traces` function. The function can be used as follows: ```julia module App @@ -87,7 +76,7 @@ Plots.plotlyjs() p = Plots.plot([1, 2, 3], show=false) @app begin - @out traces = plotly_traces(p) + @out traces = Plots.plotly_traces(p) end function ui()