-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Plotly support #50
Comments
How do we display a plot with Plotly and ElectronDisplay currently? |
My guess is that right now we fall back to SVG or PNG. In previous versions we had native support for plotly, i.e. we shipped the javascript plotly stuff in ElectronDisplay.jl, and supported a plotly MIME type, same story that we had for vega and vegalite. I think we should probably look whether there is a react plotly component that we can use in the same way that we use vega and vega-lite? |
Yes, I have found a way to display graphs with Plotly. However, I need to know the syntax for Julia. So can you give me an example of Plotly in Julia? I tried the ones on the Plotly website but it could not be executed (https://plot.ly/julia/time-series/). julia> using Plotly
julia> data = [
[
"x" => ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"],
"y" => [1, 3, 6],
"type" => "scatter"
]
]
1-element Array{Array{Pair{String,Any},1},1}:
["x" => ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"], "y" => [1, 3, 6], "type" => "scatter"]
julia> response = Plotly.plot(data, ["filename" => "date-axes", "fileopt" => "overwrite"])
ERROR: MethodError: no method matching Plot(::Array{Array{Pair{String,Any},1},1}, ::Array{Pair{String,String},1})
Closest candidates are:
Plot(::AbstractArray{T,1}, ::AbstractArray{T,1} where T) where T<:Union{Dates.Date, Dates.DateTime, AbstractString, Number, Symbol} at /Users/tll/.julia/packages/PlotlyBase/80KwD/src/convenience_api.jl:20
Plot(::AbstractArray{T,1}, ::AbstractArray{T,1} where T, ::Layout; kind, style, kwargs...) where T<:Union{Dates.Date, Dates.DateTime, AbstractString, Number, Symbol} at /Users/tll/.julia/packages/PlotlyBase/80KwD/src/convenience_api.jl:20
Plot(::AbstractArray{T,1}, ::AbstractArray{T,2} where T) where T<:(AbstractArray{T,1} where T) at /Users/tll/.julia/packages/PlotlyBase/80KwD/src/convenience_api.jl:32
...
Stacktrace:
[1] #plot#6(::Dict{Any,Any}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(plot), ::Array{Array{Pair{String,Any},1},1}, ::Vararg{Any,N} where N) at /Users/tll/.julia/packages/PlotlyJS/b9Efu/src/display.jl:145
[2] plot(::Array{Array{Pair{String,Any},1},1}, ::Vararg{Any,N} where N) at /Users/tll/.julia/packages/PlotlyJS/b9Efu/src/display.jl:145
[3] top-level scope at REPL[3]:1
julia> plot_url = response["url"]
ERROR: UndefVarError: response not defined
Stacktrace:
[1] top-level scope at REPL[4]:1
|
I think the correct package is PlotlyJS.jl. I think in theory their plot type should just have support for the I think one can also use https://github.com/JuliaPlots/Plots.jl with the plotlyjs backend, and presumably that might also create a plot object that supports plotly MIME type, but I'm again not sure. I would say we should try to use both of these packages. If they properly integrate via the plotly MIME type, great, and we'll keep the plotly support in here. If not, then I'm not sure we should try to work around that too much. |
Hey @davidanthoff thanks for brining me in here. PlotlyJS.jl does implement the mimetype (and so does Plotly.jl -- the latter package reexports everything from the former and adds in connection to plot.ly cloud/apis) My display integration was very wacky/non-standard, but has since been cleaned out. It should adhere to the Julia display stack now (I think?). Let me know what else I can do to support plotly here |
This works now. |
We should move the plotly support into the gallery as well. I think there is a plotly react package, so hopefully that won't be too difficult. We can do this later, though.
The text was updated successfully, but these errors were encountered: