Open Mo-Gul opened 2 years ago
specs
defined like this:
specs = [
Spec(kind="xy")
Spec(kind="scene")]
is a 2-element Vector{Spec}
,
but specs must be a Matrix
: https://github.com/sglyon/PlotlyBase.jl/blob/master/src/subplot_utils.jl#L155;
Hence you should reshape it :
fig = make_subplots(rows=2, cols=1, shared_xaxes=true,
specs=reshape([Spec()
Spec()], 2, 1) )
relayout!(fig, width=500, height=500)
add_trace!(fig, scatter(x=1:3, y=rand(2:7,3)), row=1, col=1)
add_trace!(fig, scatter(x=1:3, y=-1 .+ 3*rand(3)), row=2, col=1)
display(fig)
@empet, thank you for the hint how to make it work. A minor improvement to your solution to use reshape(..., :, 1)
(which is mentioned at https://stackoverflow.com/questions/34595122/the-best-way-to-convert-vector-into-matrix-in-julia#comment98245161_34599502), that is
fig = make_subplots(rows=2, cols=1, shared_xaxes=true,
specs=reshape([Spec()
Spec()], :, 1) )
Hopefully you agree that this is a workaround rather a real solution. So hopefully the definition can adjusted to take care of that "special case".
When creating a 2x1
make_subplots
withspecs
likethe error stack
The error doesn't raise when
specs
part is commented/removed orrows
andcols
build a matrix instead of a vector, e.g. a 1x2 or 2x2 grid.Version info
The output of
versioninfo()
isand the output of
using Pkg; pkg"status"
is