【发布时间】:2020-06-01 00:20:35
【问题描述】:
我目前正在绘制一个数据框,其中包含 119 个观察值,这些观察值代表国家(分类)的回收率(浮动)。我尝试制作散点图和条形图,但两次都遇到分类 y 轴过度拥挤。
我认为可以使轴更大或增加类别之间的空间,但没有找到任何有用的东西。您能否向我解释一下如何改进代码以使 y 轴上的所有国家都可观察到?
附加的是 MWE(尽管它最终很简单)、plt.plot() 输出和 dataset.info()。
MWE:
plt.plot(
rr_data['r_rate'],
rr_data['country'],
'.',
color='red')
plt.title('Recycling rates by country')
plt.ylabel('Countrycode')
plt.xlabel('Waste recycled, %')
信息:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 119 entries, 0 to 120
Data columns (total 2 columns):
country 119 non-null object
r_rate 119 non-null float64
dtypes: float64(1), object(1)
memory usage: 2.8+ KB
剧情: rr_by_country
【问题讨论】:
标签: python matplotlib plot