2

I am trying to plot duration of processes, starting from the following data frame

variable year start end seconds hours start_time start_date
0 10m_u_component_of_wind 2005 2022-04-25 13:14:45 2022-04-26 02:13:56 46751 12.986389 13:14
1 10m_u_component_of_wind 2006 2022-04-26 04:56:26 2022-04-26 14:56:35 36009 10.002500 04:56
2 10m_u_component_of_wind 2007 2022-04-26 05:01:04 2022-04-26 20:45:38 56674 15.742778 05:01
.. .. .. .. .. .. .. ..

in the following, for example, way:

cm = 1 / 2.54
figure, ax = plt.subplots(figsize=(50*cm, 20*cm))

plot = sns.stripplot(
    data=timings,
    x=timings.start_date,
    y=timings.start_time.sort_values(ascending=False),
    hue='variable',
)

# ax.set_ylim(["00:00", "23:59"])
plt.suptitle('Duration of processes')
plt.title('using patching script (commit fb14897574f55915bfc65d8be23e6242c7bdbb99)')
plt.legend()
plt.show()

If I comment out the ax.set_ylim(["00:00", "23:59"]) line, no data are plotted. Without it, the y-scale, obviously does not start at 00:00 and end at 23:59.

Question

How can I plot the duration of processes and show along start date, start time and end time, putting in one axis the hours scale? The point is (also) to emphasize how many processes needed to start very early or late (like before 08:30 AM and after 17:30 PM).

Draft hand-drawn plot

The following is surely not in proper scale. Just an idea to show in a plot:

  • start date
  • duration of a process (horizontal for easier visual estimation?)
  • start time (y axis)

Duration of processes

Alternative ideas much appreciated.

Nikos Alexandris
  • 708
  • 2
  • 22
  • 36

1 Answers1

0

I came up with something close and convinced it is easier than thought to create a plot, as per the question, using the awesomeness of Bokeh:

enter image description here

Source code posted at: https://discourse.bokeh.org/t/plotting-timestamps-values-and-highlighting-time-ranges/9804?u=nikosalexandris

Nikos Alexandris
  • 708
  • 2
  • 22
  • 36