StatsPlots @df macro with args/kwargs

I can make the following call in StatsPlots using the @df macro:

@df labs histogram(:obs_value, group = :observation, legend = :topright, size = (1500,300))

However, when I try

foo = :observation
baz = :obs_value
@df labs histogram(baz, group = foo, legend = :topright, size = (1500,300))

I get

MethodError: no method matching extractGroupArgs(::Symbol, ::Symbol)

back from the repl (presumably because the macro isn’t/can’t interpolate the values in the variables at runtime?). Is there a way to get this sort of behavior using the macro? Or does this need to be done with functions?

Wrap with cols, e.g. @df df plot(cols(baz),...

1 Like

Works like a charm. I blasted right through that section of the StatsPlots README. Thanks!