Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String column selector does not work in mapping() #581

Open
2 tasks done
msberk opened this issue Nov 18, 2024 · 0 comments
Open
2 tasks done

String column selector does not work in mapping() #581

msberk opened this issue Nov 18, 2024 · 0 comments

Comments

@msberk
Copy link

msberk commented Nov 18, 2024

Bug description

I am unable to use string-typed column selectors in mapping(), which should be possible according to the documentation. Wrapping the strings in Symbol resolves the issue.

Steps to reproduce

using AlgebraOfGraphics, CairoMakie
using DataFrames

x = 0.0:0.1:2.0*π
ysin = sin.(x)
df = DataFrame("Time (s)" => x, "Magnitude" => ysin)

draw(data(df) * mapping("Time (s)", "Magnitude") * visual(Lines))

Error reporting

ERROR: Unknown color: Time (s)
Stacktrace:
  [1] error(::String, ::String)
    @ Base .\error.jl:44
  [2] _parse_colorant(desc::String)
    @ Colors C:\Users\mb699\.julia\packages\Colors\E2qak\src\parse.jl:151
  [3] parse
    @ C:\Users\mb699\.julia\packages\Colors\E2qak\src\parse.jl:207 [inlined]
  [4] parse_colorant
    @ C:\Users\mb699\.julia\packages\Compose\9ma5l\src\Compose.jl:43 [inlined]
  [5] fill(c::String)
    @ Compose C:\Users\mb699\.julia\packages\Compose\9ma5l\src\property.jl:78
  [6] (::AlgebraOfGraphics.var"#wrap#172")(x::String)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:17
  [7] (::AlgebraOfGraphics.var"#170#175"{Vector{Any}})(v::String)
    @ AlgebraOfGraphics .\none:0
  [8] iterate
    @ .\generator.jl:48 [inlined]
  [9] iterate
    @ .\iterators.jl:1253 [inlined]
 [10] iterate(f::Base.Iterators.Flatten{Base.Generator{Tuple{…}, AlgebraOfGraphics.var"#171#174"}})
    @ Base.Iterators .\iterators.jl:1247
 [11] shape
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:23 [inlined]
 [12] getlabeledarray(layer::Layer, s::String)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:67
 [13] (::AlgebraOfGraphics.var"#204#210"{Layer})(v::String)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:128
 [14] iterate
    @ .\generator.jl:48 [inlined]
 [15] _collect(c::Vector{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base .\array.jl:800
 [16] collect_similar
    @ .\array.jl:709 [inlined]
 [17] map
    @ .\abstractarray.jl:3371 [inlined]
 [18] process_mappings(layer::Layer)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:128
 [19] process(layer::Layer)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\processing.jl:162
 [20] ProcessedLayers
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\layers.jl:55 [inlined]
 [21] compute_axes_grid(d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\layers.jl:250
 [22] compute_axes_grid
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\layers.jl:248 [inlined]
 [23] compute_axes_grid(fig::Figure, d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\layers.jl:218
 [24] compute_axes_grid
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\algebra\layers.jl:215 [inlined]
 [25] #363
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:20 [inlined]
 [26] update
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:10 [inlined]
 [27] plot!(fig::Figure, d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:20
 [28] plot!
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:16 [inlined]
 [29] (::AlgebraOfGraphics.var"#374#379"{…})(f::Figure)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:162
 [30] update
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:10 [inlined]
 [31] _draw(d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{…}, figure::Dictionaries.Dictionary{…}, facet::Dictionaries.Dictionary{…}, legend::Dictionaries.Dictionary{…}, colorbar::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:161
 [32] _draw
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:154 [inlined]
 [33] draw(d::Layer, scales::AlgebraOfGraphics.Scales; axis::@NamedTuple{…}, figure::@NamedTuple{}, facet::@NamedTuple{}, legend::@NamedTuple{}, colorbar::@NamedTuple{}, palette::Nothing)
    @ AlgebraOfGraphics C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:85
 [34] draw
    @ C:\Users\mb699\.julia\packages\AlgebraOfGraphics\BPWA1\src\draw.jl:75 [inlined]
 [35] top-level scope
    @ c:\Users\mb699\git\julia\ReadWrf\src\scratch.jl:11
Some type information was truncated. Use `show(err)` to see complete types.

Version info

julia> versioninfo()
Julia Version 1.11.0
Commit 501a4f25c2 (2024-10-07 11:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =
  [cbdf2221] AlgebraOfGraphics v0.8.13
  [13f3f980] CairoMakie v0.12.16
  [e9467ef8] GLMakie v0.10.16
  [a93c6f00] DataFrames v1.7.0

Before opening an issue

  • Make sure you are on the latest release of AlgebraOfGraphics and Makie.
  • Make sure no other issue exists describing the same problem you have encountered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant