tucan icon indicating copy to clipboard operation
tucan copied to clipboard

Plotting DataFrames with `Elixir.Time` columns

Open spencerkent opened this issue 8 months ago • 6 comments

Hey, thanks for the useful library!

I was surprised to get a blank graph in response to the following:

iex> times = 0..10 |> Enum.map(&(DateTime.utc_now() |> DateTime.to_time() |> Time.add(&1)))
[~T[05:33:08.404477], ~T[05:33:09.404555], ~T[05:33:10.404564], ~T[05:33:11.404577],
 ~T[05:33:12.404579], ~T[05:33:13.404581], ~T[05:33:14.404583], ~T[05:33:15.404586],
 ~T[05:33:16.404588], ~T[05:33:17.404590], ~T[05:33:18.404592]]
iex> test_df = DF.new(
  %{
      time_col: times,
      value_col: 10..20 |> Enum.to_list()
    }
)
#Explorer.DataFrame<
  Polars[11 x 2]
  time_col time [05:33:08.404477, 05:33:09.404555, 05:33:10.404564, 05:33:11.404577,
   05:33:12.404579, ...]
  value_col s64 [10, 11, 12, 13, 14, ...]
>
Tucan.lineplot(test_df, "time_col", "value_col")
Screenshot 2024-06-20 at 11 40 20 PM

Providing the temporal-type argument does not yield anything different:

Tucan.lineplot(test_df, "time_col", "value_col", x: [type: :temporal])

Am I missing a configuration parameter that's needed for Tucan to show the plot?

spencerkent avatar Jun 21 '24 05:06 spencerkent