Skip to content

Commit f4539dc

Browse files
authored
Merge pull request #415 from JuliaPlots/add_shape
add_shape
2 parents b8426a5 + 2dfbf27 commit f4539dc

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PlotlyJS"
22
uuid = "f0f68f2c-4968-5e81-91da-67840de0976a"
33
authors = ["Spencer Lyon <[email protected]>"]
4-
version = "0.18.5"
4+
version = "0.18.6"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -22,7 +22,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
2222
Blink = "0.12"
2323
JSExpr = "0.5, 1"
2424
JSON = "0.20, 0.21"
25-
PlotlyBase = "0.8.9"
25+
PlotlyBase = "0.8.15"
2626
Reexport = "0.2, 1"
2727
Requires = "1.0"
2828
WebIO = "0.8"

src/PlotlyJS.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using Blink
2121
using Pkg.Artifacts
2222
using Requires
2323

24-
export plot, dataset, list_datasets, make_subplots, savefig
24+
export plot, dataset, list_datasets, make_subplots, savefig, mgrid
2525

2626
# globals for this package
2727
const _pkg_root = dirname(dirname(@__FILE__))
@@ -174,7 +174,7 @@ for (k, v) in vcat(PlotlyBase._layout_obj_updaters, PlotlyBase._layout_vector_up
174174
end
175175
end
176176

177-
for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!]
177+
for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!, :add_shape!, :add_layout_image!]
178178
@eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...)
179179
$(k)(p.plot, args...; kwargs...)
180180
send_command(p.scope, :react, p.plot.data, p.plot.layout)

src/display.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end
1616
function Base.show(io::IO, mm::MIME"text/html", p::SyncPlot)
1717
# if we are rendering docs -- short circuit and display html
1818
if get_renderer() == DOCS
19-
return show(io, mm, p.plot, full_html=false, include_plotlyjs="require-loaded")
19+
return show(io, mm, p.plot, full_html=false, include_plotlyjs="require-loaded", include_mathjax=false)
2020
end
2121
show(io, mm, p.scope)
2222
end
@@ -184,7 +184,7 @@ end
184184

185185
function add_trace!(p::SyncPlot, trace::GenericTrace; kw...)
186186
add_trace!(p.plot, trace; kw...)
187-
send_command(p.scope, :addTraces, trace)
187+
send_command(p.scope, :react, p.plot.data, p.plot.layout)
188188
end
189189

190190

src/util.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ function PlotlyBase.add_recession_bands!(p::SyncPlot; kwargs...)
1414
relayout!(p, shapes=new_shapes)
1515
new_shapes
1616
end
17+
18+
function mgrid(arrays...)
19+
lengths = collect(length.(arrays))
20+
uno = ones(Int, length(arrays))
21+
out = []
22+
for i in 1:length(arrays)
23+
repeats = copy(lengths)
24+
repeats[i] = 1
25+
26+
shape = copy(uno)
27+
shape[i] = lengths[i]
28+
push!(out, reshape(arrays[i], shape...) .* ones(repeats...))
29+
end
30+
out
31+
end

0 commit comments

Comments
 (0)