Lexical dispersion plot is seaborn

故事扮演 提交于 2019-12-05 22:40:40

You have to use stripplot. Firstly, you have to properly read datetime column of your data and then plot it:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# datetime parser
dateparse = lambda x: pd.datetime.strptime(x, '%y/%m/%d %H:%M')
df = pd.read_csv('./sample_data.csv',parse_dates=['DateTime'], date_parser=dateparse)

# set size of figure
plt.figure(figsize=(22,6))
# use horizontal stripplot with x marker size of 5
sns.stripplot(y='Weather',x='DateTime', data=df,
 orient='h', marker='X', color='navy', size=5)
# rotate x tick labels
plt.xticks(rotation=15)
# remover borders of plot
plt.tight_layout()
plt.show()

Figure is clickable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!