Skip to content

Using JuliaDB/IndexedTables with Gadfly #94

Open
@cmcaine

Description

@cmcaine

So I'm just trying to get Gadfly to plot an IndexedTable I've produced with the JuliaDB.table function.

The IterableTables documentation claims to support JuliaDB tables as data sources and Gadfly as a sink, but I'm doing it wrong and/or it doesn't work for me

Complete example:

julia> using IterableTables, JuliaDB, Gadfly

julia> t = table(1:10, (1:10) * 3, names = (:x, :y))
Table with 10 rows, 2 columns:
x   y
──────
1   3
2   6
3   9
4   12
5   15
6   18
7   21
8   24
9   27
10  30

julia> typeof(t)
IndexedTable{StructArrays.StructArray{NamedTuple{(:x, :y),Tuple{Int64,Int64}},1,NamedTuple{(:x, :y),Tuple{Array{Int64,1},Array{Int64,1}}}}}

julia> plot(t, x=:x, y=:y, Geom.point)
ERROR: MethodError: no method matching evalmapping(::IndexedTable{StructArrays.StructArray{NamedTuple{(:x, :y),Tuple{Int64,Int64}},1,NamedTuple{(:x, :y),Tuple{Array{Int64,1},Array{Int64,1}}}}}, ::Symbol)

```Closest candidates are:
  evalmapping(::Any, ::AbstractArray) at /home/colin/.julia/packages/Gadfly/09PWZ/src/mapping.jl:185
  evalmapping(::Any, ::Function) at /home/colin/.julia/packages/Gadfly/09PWZ/src/mapping.jl:186
  evalmapping(::Any, ::Distributions.Distribution) at /home/colin/.julia/packages/Gadfly/09PWZ/src/mapping.jl:187
  ...
Stacktrace:
 [1] evalmapping!(::Dict{Symbol,Any}, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:x, :y),Tuple{Int64,Int64}},1,NamedTuple{(:x, :y),Tuple{Array{Int64,1},Array{Int64,1}}}}}, ::Gadfly.Data) at /home/colin/.julia/packages/Gadfly/09PWZ/src/mapping.jl:220
 [2] #plot#65(::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol,Symbol},NamedTuple{(:x, :y),Tuple{Symbol,Symbol}}}, ::Function, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:x, :y),Tuple{Int64,Int64}},1,NamedTuple{(:x, :y),Tuple{Array{Int64,1},Array{Int64,1}}}}}, ::Type{Gadfly.Geom.PointGeometry}) at /home/colin/.julia/packages/Gadfly/09PWZ/src/Gadfly.jl:327
 [3] (::getfield(Gadfly, Symbol("#kw##plot")))(::NamedTuple{(:x, :y),Tuple{Symbol,Symbol}}, ::typeof(plot), ::IndexedTable{StructArrays.StructArray{NamedTuple{(:x, :y),Tuple{Int64,Int64}},1,NamedTuple{(:x, :y),Tuple{Array{Int64,1},Array{Int64,1}}}}}, ::Type{Gadfly.Geom.PointGeometry}) at ./none:0
 [4] top-level scope at none:0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions