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

Plot based on lens on column (e.g. tuple-valued column) #316

Open
goretkin opened this issue Jun 25, 2020 · 1 comment
Open

Plot based on lens on column (e.g. tuple-valued column) #316

goretkin opened this issue Jun 25, 2020 · 1 comment
Labels
Milestone

Comments

@goretkin
Copy link

Instead of

df.hallway_width2 = map(x->x[2], df[!, :hallway_widths])

df |> @vlplot(
    mark={:boxplot, extent="min-max"},
    x = {:hallway_width2},
    y = {:tree_size, axis={title="tree size"}}
)

Is it possible to do something like

df |> @vlplot(
    mark={:boxplot, extent="min-max"},
    x = {:hallway_width, accessor=x->x[2]},
    y = {:tree_size, axis={title="tree size"}}
)

?

@davidanthoff
Copy link
Member

Is the idea here that the column hallway_widths is of type Pair or Tuple or something like that, and you want to extract the second element?

I would do this with Query.jl:

df |>
@mutate(hallway_width2 = _.hallway_widths[2]) |>
@vlplot(...)

@davidanthoff davidanthoff added this to the Backlog milestone Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants