Plotting two specific columns from a dataframe on one plot using PlutoPlotly

PeX
Fri, 16 Feb 2024 20:06:08 +0000
Visualization

Hi everyone,
I have a DataFrame with one date data and the other columns are just numbers.
I want to create a plot of two specific columns df.data1 and df.data3 against the date column on the x-axis.
When I try something like the following:

p1 = scatter(df.Date, df.data1)
p2 = scatter(df.Date, df.data3)
plot([p1,p2], xaxis_type= "date")

I get an error:
MethodError: no method matching scatter(::Vector{Dates.Date}, ::Vector{Float64})
However If I try to plot just one column like so:

plot(df.Date, df.data1, xaxis_type= "date")

It works!

Is there any other way maybe to add more columns to the plot?

Thank you!

4 posts - 2 participants