I have a pandas data frame with multiple columns that contain dates and one column with labels (string).
I want to plot the labels on the y-axis and the corresponding dates on the x-axis for all the columns. When I plot one it looks ok but then when I start adding the other columns it overplots the new data points and misses up the x-axis ticks.
Anyone knows what is causing this?
Here is a sample
Code | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 |
---|---|---|---|---|---|---|
A1 | 8/1/2011 | 7/20/2012 | 7/10/2013 | 6/28/2014 | 6/18/2015 | 6/6/2016 |
A2 | 8/1/2011 | 7/20/2012 | 7/10/2013 | 6/28/2014 | 6/18/2015 | 6/6/2016 |
A3 | 7/10/2013 | 6/29/2014 | 6/18/2015 | 6/6/2016 | ||
A4 | 7/10/2013 | 6/28/2014 | 6/18/2015 | 6/6/2016 |
df = pd.read_csv('dates.csv', parse_dates=['2011', '2012', '2013', '2014', '2015', '2016'])
fig, ax = plt.subplots(figsize=(10, 6))
sns.stripplot(pd.to_datetime(df['2012']), df['Code'], color = 'r')
sns.stripplot(pd.to_datetime(df['2013']), df['Code'], color = 'g')
sns.stripplot(pd.to_datetime(df['2014']), df['Code'], color = 'k')
plt.xticks(rotation='vertical')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.