JuliaPlots / JuliaPlots/PlotlyJS.jl

`make_subplots` raises error on 2x1 plots with `specs`

Open
#430 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

When creating a 2x1 `make_subplots` with `specs` like

```jl
p = make_subplots(
rows=2, cols=1,
shared_xaxes=true,
specs=[
Spec()
Spec()
]
)
```

the error stack

```jl
ERROR: LoadError: MethodError: no method matching (Matrix{<:Union{Missing, Spec}})(::Vector{Spec})
Stacktrace:
[1] convert(#unused#::Type{Matrix{<:Union{Missing, Spec}}}, a::Vector{Spec})
@ Base .\array.jl:554
[2] Subplots(rows::Int64, cols::Int64, shared_xaxes::Bool, shared_yaxes::Bool, start_cell::String, subplot_titles::Missing, column_widths::Missing, row_heights::Missing, specs::Vector{Spec}, insets::Missing, column_titles::Missing, row_titles::Missing, x_title::Missing, y_title::Missing, grid_ref::Matrix{Vector{PlotlyBase.SubplotRef}}, has_secondary_y::Bool, horizontal_spacing::Float64, vertical_spacing::Float64, max_width::Float64, _widths::Vector{Float64}, _heights::Vector{Float64})
@ PlotlyBase \.julia\packages\Parameters\MK0O4\src\Parameters.jl:505
[3] Subplots(; rows::Int64, cols::Int64, shared_xaxes::Bool, shared_yaxes::Bool, start_cell::String, subplot_titles::Missing, column_widths::Missing, row_heights::Missing, specs::Vector{Spec}, insets::Missing, column_titles::Missing, row_titles::Missing, x_title::Missing, y_title::Missing, grid_ref::Matrix{Vector{PlotlyBase.SubplotRef}}, has_secondary_y::Bool, horizontal_spacing::Float64, vertical_spacing::Float64, max_width::Float64, _widths::Vector{Float64}, _heights::Vector{Float64})
@ PlotlyBase \.julia\packages\Parameters\MK0O4\src\Parameters.jl:493
[4] make_subplots(; kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:rows, :cols, :shared_xaxes, :specs), Tuple{Int64, Int64, Bool, Vector{Spec}}}})
@ PlotlyJS \.julia\packages\PlotlyJS\4jzLr\src\PlotlyJS.jl:40
[5] top-level scope
@ \test.jl:76
in expression starting at \test.jl:76
```

The error doesn't raise when
- the `specs` part is commented/removed or
- the `rows` and `cols` build a matrix instead of a vector, e.g. a 1x2 or 2x2 grid.

**Version info**

The output of `versioninfo()` is

```jl
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, tigerlake)
Environment:
JULIA_EDITOR = code.cmd
JULIA_NUM_THREADS =
```

and the output of `using Pkg; pkg"status"` is

```jl
Status `\Project.toml`
[a93c6f00] DataFrames v1.3.1
[f0f68f2c] PlotlyJS v0.18.8
[fdbf4ff8] XLSX v0.7.8
[10745b16] Statistics
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.