I want to create a plot like this: Connected horizontal line plot
I know how to create horizontal lines in Matplotlib, and I see a way of creating many short horizontal lines and to connect them with short vertical lines, but I have the intuition that a better way is possible.
I have tried this code myself:
import matplotlib.pyplot as plt
y = [1, 1, 3, 3, 6, 6]
x = [1, 2, 2, 3, 3, 4]
plt.plot(x, y)
plt.show()
It produces this plot.
It has the basics of what I want, but since I have data per month, creating a plot like this requires some awkward data manipulation.
Lastly, I also thought of creating a bar plot which only show the top line of the bar, which would nicely create the horizontal lines, but they would not be connected.
Thanks in advance for your help!
