So I've seen a few answers on here that helped a bit, but my dataset is larger than the ones that have been answered previously. To give a sense of what I'm working with, here's a link to the full dataset. I imported this into a jupyter notebook using pandas. I've included a picture of one attempted solution, which was found at this link, right here: Example Picture. The issue is that 1. This is difficult to read and 2. I don't know how to flatten it out so that it looks like a traditional timeline. The issue becomes more apparent when I try and work with larger segments, such as this one: It's basically unreadable. Here's the code I used to produce both of these (I just modified the included code in order to change which section of the overall dataset was used).
event = Xia['EnglishName'] begin = Xia['Start'] end = Xia['Finish'] length = Xia['Length'] plt.figure(figsize=(12,6)) plt.barh(range(len(begin)), (end-begin), .3, left=begin) plt.tick_params(axis='both', which='major', labelsize=15) plt.tick_params(axis='both', which='minor', labelsize=20) plt.title('Xia Dynasty', fontsize = '25') plt.xlabel('Year', fontsize = '20') plt.yticks(range(len(begin)), "") plt.xlim(-2250, -1750) plt.ylim(-1,18) for i in range(18): plt.text(begin.iloc[i] + length.iloc[i]/2, i+.25, event.iloc[i], ha='center', fontsize = '12')
This code semi-works, but I'd prefer if the bars were either closer together or differently colored and all on the same y-value. I appreciate any and all help. I've been trying to figure this out for about two weeks now and am hitting a brick wall.