Skip to content

axislegend cannot be positioned using a Tuple of numbers #2006

@asinghvi17

Description

@asinghvi17

Executing the following MWE errors. However, the docstring mentions this as a possible invocation.

using Makie, MakieLayout
fig, ax, plt = lines(rand(10), label = "a label")
leg = axislegend(ax; position = (1, 1))
Error
MethodError: Cannot `convert` an object of type Int64 to an object of type Symbol
Closest candidates are:
  convert(::Type{T}, ::Intervals.AnchoredInterval{P, T}) where {P, T} at ~/.julia/packages/Intervals/CTTZL/src/anchoredinterval.jl:181
  convert(::Type{T}, ::Intervals.Interval{T}) where T at ~/.julia/packages/Intervals/CTTZL/src/interval.jl:240
  convert(::Type{T}, ::P) where {T, P<:(AbstractPolynomial{T})} at ~/.julia/packages/Polynomials/Rrf70/src/common.jl:434
  ...

Stacktrace:
  [1] setproperty!(x::Observable{Symbol}, f::Symbol, v::Int64)
    @ Base ./Base.jl:39
  [2] setindex!(observable::Observable, val::Any)
    @ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:85
  [3] (::Observables.var"#17#18"{Observable{Symbol}})(x::Int64)
    @ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:418
  [4] on(f::Any, observable::Observables.AbstractObservable; weak::Bool, priority::Int64, update::Bool)
    @ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:281
  [5] connect!
    @ ~/.julia/packages/Observables/ynr7h/src/Observables.jl:418 [inlined]
  [6] connect_block_layoutobservables!(leg::Legend, layout_width::Observable{Any}, layout_height::Observable{Any}, layout_tellwidth::Observable{Bool}, layout_tellheight::Observable{Bool}, layout_halign::Observable{Symbol}, layout_valign::Observable{Symbol}, layout_alignmode::Observable{Any})
    @ Makie.MakieLayout ~/.julia/dev/Makie/src/makielayout/blocks/legend.jl:244
  [7] _block(T::Type{Legend}, fig_or_scene::Figure, args::Observable{Vector{Tuple{Union{Nothing, AbstractString}, Vector{LegendEntry}}}}; bbox::Observable{GeometryBasics.HyperRectangle{2, Int64}}, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:margin, :halign, :valign), Tuple{NTuple{4, Int64}, Int64, Int64}}})
    @ Makie.MakieLayout ~/.julia/dev/Makie/src/makielayout/blocks.jl:413
  [8] #_#38
    @ ~/.julia/dev/Makie/src/makielayout/blocks.jl:269 [inlined]
  [9] Legend(fig_or_scene::Figure, contents::Vector{AbstractPlot}, labels::Vector{LaTeXString}, title::Nothing; kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:bbox, :margin, :halign, :valign), Tuple{Observable{GeometryBasics.HyperRectangle{2, Int64}}, NTuple{4, Int64}, Int64, Int64}}})
    @ Makie.MakieLayout ~/.julia/dev/Makie/src/makielayout/blocks/legend.jl:474
 [10] Legend(fig_or_scene::Figure, axis::Axis, title::Nothing; merge::Bool, unique::Bool, kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:bbox, :margin, :halign, :valign), Tuple{Observable{GeometryBasics.HyperRectangle{2, Int64}}, NTuple{4, Int64}, Int64, Int64}}})
    @ Makie.MakieLayout ~/.julia/dev/Makie/src/makielayout/blocks/legend.jl:530
 [11] #axislegend#749
    @ ~/.julia/dev/Makie/src/makielayout/blocks/legend.jl:595 [inlined]
 [12] #axislegend#747
    @ ~/.julia/dev/Makie/src/makielayout/blocks/legend.jl:571 [inlined]
 [13] top-level scope
    @ In[59]:1
 [14] eval
    @ ./boot.jl:368 [inlined]
 [15] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1277

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions