Skip to content

Support figures generated by Plots.jl with a PlotlyBackend #214

Description

@mbauman

Given that Plots.jl supports Plotly as a backend — and can generate the requisite key-value blobs that Dash needs — it'd be very nice to use that as the unified plotting API as an easy path. And this is really easy to support. All we need is this one line of code:

import Dash, Plots
Dash.DashBase.to_dash(p::Plots.Plot{Plots.PlotlyBackend}) = (data = Plots.plotly_series(p), layout = Plots.plotly_layout(p))

So it'd be great if we could wire up Plots as a weakdep (with both Requires for v1.8 and below and Extensions on v1.9+) and define that very simple line of code, which enables very straightforward usage like this:

app = Dash.dash()
app.layout = Dash.html_div() do
    Dash.html_h1("Dash 🤝 Plots"),
    Dash.dcc_graph(id = "test", figure= Plots.plot(1:10, rand(10)))
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions