juliajulia-plots

julia plot not working with float64 vectors


I'm trying to plot 2 series, a training set and a testing set with plots:

xp = append!(XTrain.humidity, data.humidity)
yp = append!(YTrain, predictions)
println(length(xp))
println(length(yp))
Plots.plot(x=xp, y=yp,seriestype=:scatter)

this outputs

382
382

which is the expected result, with both xp and yp being a vector of floats

xp = [82.00274423, 80.31964408, 82.3207629, 83.37011772, 82.63941394, 82.894086...]
yp = [49.027397, 49.027397, 49.027397, 49.027397 ...]

But the plot in the output looks like this: not points


Solution

  • You're getting this plot because there's nothing to plot. Plots.plot is supposed to be called like this, with the data to plot being passed as positional arguments:

    Plots.plot(xp, yp, seriestype=:scatter)
    

    AFAIK, keyword arguments are for customizing the plot (like setting series type), not for passing data to plot.