Which chart for days on y-, hours on x-axis?

Which chart would be best-suited for this specific use-case: whole days on the y-axis and time per day on the x-axis (that is: 00 - 24)?

All values on the x-axis are either 0 oder 1, the chart would ideally look like this:

2023-03-01          x----x----xx--
2023-03-02          ---x----x----x
2023-03-03          x-------x----x
                    00    12    24   <- time
^
|
days

Hi @pheeth welcome to the forums.

I adapted my answer from this thread because the chart seemed to be pretty similar. There might be other ways to do this, but since I had this chart in my mind, I adapted it :grimacing:

import plotly.graph_objects as go
import numpy as np
import random

# set number of days
days = 10

# set number of hours
hours = 24

# add one hour for use in range()
hours += 1

# create data
categories = []
for i in range(1, days + 1):
    categories.extend([f'day_{i}'] * hours)
types = [i for i in range(hours)] * days    
values = [random.choice(['x','-']) for _ in range(days * hours)]

# create figure
fig = go.Figure(
    data=go.Scatter(
        y=categories, 
        x=types, 
        text=values, 
        mode='text'
    ),
    layout={'height': 600, 'width': 600}
)

fig.update_xaxes(
    tickmode='array', 
    ticktext=[*range(hours)], 
    tickvals = [*range(hours)]
)

creates:

2 Likes