I am trying to find a visual that will be able to showcase events by categories.
- Category on the y-axis (e.g. Rain, Snow, Thunderstorm)
- Timeline on the x-axis (e.g. Months of the year)
Every time there was rain snow or thunder, there should be a dot on the time it happened along its category section.
What I tried is using a px.bar chart with horizontal orientation but it doesn’t really work
Ideal graph should look like this:
You could start from something like:
cat_list = ["rain", "snow", "thunder"]
fig = go.Figure()
for idx, cat in enumerate(cat_list):
# this will add one dot per item in cat_timestamp_list
# the dots will be along the y=idx+1 line
y=[idx+1 for i in cat_timestamp_list],
# format yticks to match cat names
yaxis = dict(
tickmode = 'array',
tickvals = [idx + 1 for idx in range(cat_list)],
ticktext = cat_list
You would have to format the date in xaxis as well, but this is well covered in the documentation. I am not sure if there is a simpler solution with express, it could be.
Is there any way to create more than 2 levels of axis category? From the offical doc, I see there is only 2 levels of axis categories allown to be created while my case is users asking for multiple (larger than 2) levels of axis category.