This works:
StatsPlots.@df SYN_MM_BM_df plot(
:t,
[:SYN_MM_BM_5, :SYN_MM_BM_10, :SYN_MM_BM_15, :SYN_MM_BM_30]
)
But this does not:
StatsPlots.@df SYN_MM_BM_df plot(
:t,
[Symbol(name) for name in names(SYN_MM_BM_df[2:5])]
)
Error: Cannot convert Symbol to series data for plotting
Although:
[Symbol(name) for name in names(SYN_MM_BM_df)[2:5]] ==
[:SYN_MM_BM_5, :SYN_MM_BM_10, :SYN_MM_BM_15, :SYN_MM_BM_30
is true.
Can anyone explain why? I'd really like to not type all the symbols individually...
To work around the limitation that @Nils Gudat highlighted use cols
(it treats its contents as a variable and expands it to columns) to get what you want (and use propertynames
on data frame to get its column names as symbols directly):
julia> df = DataFrame(x=1:10, y=rand(10), z=rand(10));
julia> @df df plot(:x, cols(propertynames(df)[2:end]))
gives you:
which is what I assume you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With