InexactError: Int64(0.2) in GLMakie plot

Viewed 47

I am trying to make an animated line-scatter plot through GLMakie but I keep getting an error ERROR: InexactError: Int64(0.2). I tried another dataset with the same data types and it worked without any error.

I guess I am still cofused by the Int64 type. Any suggestion to resolve this?

julia> d1
20×3 DataFrame
 Row │ date        value  value2
     │ Date        Int64  Int64
─────┼───────────────────────────
   1 │ 2020-01-22      1       2
   2 │ 2020-01-23      1       2
   3 │ 2020-01-24      2       4
   4 │ 2020-01-25      2       4
   5 │ 2020-01-26      5      10
   6 │ 2020-01-27      5      10
   7 │ 2020-01-28      5      10
   8 │ 2020-01-29      6      12
   9 │ 2020-01-30      6      12
  10 │ 2020-01-31      8      16
  11 │ 2020-02-01      8      16
  12 │ 2020-02-02      8      16
  13 │ 2020-02-03     11      22
  14 │ 2020-02-04     11      22
  15 │ 2020-02-05     11      22
  16 │ 2020-02-06     12      24
  17 │ 2020-02-07     12      24
  18 │ 2020-02-08     12      24
  19 │ 2020-02-09     12      24
  20 │ 2020-02-10     12      24

fig = Figure(resolution = (800, 480))

ax1 = fig[1, 1] = Axis(fig,
    # title
    title = "US COVID-19",
    titlegap = 14, titlesize = 14,
    xlabel = "Year", xlabelsize = 12,
    ylabel = "Cases", ylabelsize = 12
)

frames = 1:(length(d1.date))
colors = [:red, :blue]
columns = propertynames(d1)[2:end]

record(fig, "covid_US.mp4", frames; framerate = 2) do i
    for j in 1:length(columns)
        lines!(ax1, d1[1:i, 1], d1[1:i, (j + 1)],
            color = (colors[j], 0.5)
        )
        scatter!(ax1, d1[1:i, 1], d1[1:i, (j + 1)],
            color = colors[j]
        )
    end
end
0 Answers
Related