【发布时间】:2017-02-08 01:55:07
【问题描述】:
我下面的代码生成了一个图表,其中 x 轴上的标签被挤压在一起并且难以阅读。如何只显示每隔一年而不是所有年份?
import seaborn as sns
import pandas as pd
years = list(range(1996,2017))
count = [2554.9425,2246.3233,1343.7322,973.9502,706.9818,702.0039,725.9288,
598.7818,579.0219,485.8281,474.9578,358.1385,311.4344,226.3332,
161.4288,132.7368,78.1659,39.8121,23.1321,0.2232,0.0015]
df = pd.DataFrame({'year':years, 'count':count})
dot_size = 0.7
ax = sns.pointplot(x="year",y="count", scale = dot_size, data=df)
ax.set(xlabel='Year', ylabel='Amount')
ax.set(ylim=(0, 3000))
【问题讨论】: