Skip to content

Commit a9a1870

Browse files
committed
fix display in 1.11.5
1 parent c27f0a5 commit a9a1870

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

Project.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PlotlyLight"
22
uuid = "ca7969ec-10b3-423e-8d99-40f33abb42bf"
33
authors = ["joshday <emailjoshday@gmail.com>"]
4-
version = "0.11.1"
4+
version = "0.12.0"
55

66
[deps]
77
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@@ -10,8 +10,6 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
1010
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
1111
EasyConfig = "acab07b0-f158-46d4-8913-50acef6d41fe"
1212
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
13-
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
14-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1513

1614
[compat]
1715
Aqua = "0.8"
@@ -21,7 +19,6 @@ Dates = "1"
2119
Downloads = "1.6"
2220
EasyConfig = "0.1"
2321
JSON3 = "1.14"
24-
REPL = "1"
2522
julia = "1.7"
2623

2724
[extras]

src/PlotlyLight.jl

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ module PlotlyLight
22

33
using Artifacts: @artifact_str
44
using Downloads: download
5-
using Random: randstring
65
using Dates
7-
using REPL: REPLDisplay
86

97
using JSON3: JSON3
108
using 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))
7674
end
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-
9285
Base.getproperty(p::Plot, x::Symbol) = x in fieldnames(Plot) ? getfield(p, x) : (; kw...) -> p(plot(; type=x, kw...))
9386
Base.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))
157150
end
158151
Base.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

test/runtests.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ end
2525

2626
#-----------------------------------------------------------------------------# Plot methods
2727
@testset "Plot methods" begin
28-
p = Plot(Config(x = 1:10, type=:scatter))
28+
p = plot.scatter(x=1:10)
2929
@test p isa Plot
30-
@test Plot(; x=1:10, type=:scatter) == p
30+
@test plot(; x=1:10, type=:scatter) == p
3131
@test !occursin("Title", html(p))
3232
@test occursin("\"displaylogo\":false", html(p))
3333

0 commit comments

Comments
 (0)