@@ -2,9 +2,7 @@ module PlotlyLight
22
33using Artifacts: @artifact_str
44using Downloads: download
5- using Random: randstring
65using Dates
7- using REPL: REPLDisplay
86
97using JSON3: JSON3
108using EasyConfig: Config
@@ -71,7 +69,7 @@ mutable struct Plot
7169 data:: Vector{Config}
7270 layout:: Config
7371 config:: Config
74- Plot (data:: AbstractVector , layout = Config (), config = Config ()) = new (Config .(data), Config (layout), Config (config))
72+ Plot (data:: AbstractVector = Config[] , layout = Config (), config = Config ()) = new (Config .(data), Config (layout), Config (config))
7573 Plot (data, layout = Config (), config = Config ()) = new ([Config (data)], Config (layout), Config (config))
7674end
7775
@@ -84,11 +82,6 @@ save(file::AbstractString, p::Plot) = save(p, file)
8482(p:: Plot )(data:: Config ) = (push! (p. data, data); return p)
8583(p:: Plot )(p2:: Plot ) = merge! (p, p2)
8684
87- function Plot (; kw... )
88- Base. depwarn (" `Plot(; kw...)` is deprecated. Use `plot(; kw...)` instead." , :Plot , force= true )
89- plot (; kw... )
90- end
91-
9285Base. getproperty (p:: Plot , x:: Symbol ) = x in fieldnames (Plot) ? getfield (p, x) : (; kw... ) -> p (plot (; type= x, kw... ))
9386Base. propertynames (p:: Plot ) = vcat (fieldnames (Plot)... , keys (plotly. schema. traces)... )
9487
@@ -156,8 +149,11 @@ function Base.show(io::IO, ::MIME"text/html", o::Plot)
156149 show (io, MIME (" text/html" ), html_div (o))
157150end
158151Base. show (io:: IO , :: MIME"juliavscode/html" , o:: Plot ) = show (io, MIME (" text/html" ), o)
152+ Base. show (io:: IO , :: MIME"text/plain" , o:: Plot ) = Cobweb. preview (html_page (o), reuse= settings. reuse_preview)
153+
154+ # Base.display(::REPLDisplay, o::Plot) = Cobweb.preview(html_page(o), reuse=settings.reuse_preview)
155+ # Base.display(::REPLDisplay, ::MIME"text/plain", o::Plot) = Cobweb.preview(html_page(o), reuse=settings.reuse_preview)
159156
160- Base. display (:: REPLDisplay , o:: Plot ) = Cobweb. preview (html_page (o), reuse= settings. reuse_preview)
161157
162158
163159# -----------------------------------------------------------------------------# preset
0 commit comments