python - 连通散点图
问题描述
我需要帮助将此图的点与线连接起来:
这是我的代码:
country_stats.plot(kind='line',
x="GDP per capita",
y='Life satisfaction',
color='blue',
figsize=(8,3))
plt.axis([0, 110000, 0, 10])
解决方案
尝试添加style='.-'
as kwarg for country_stats.plot()
。
编辑:
鉴于您已经拥有colors
in pandas.DataFrame.plot()
,请添加marker='.-'
而不是style='.-'
.
推荐阅读
- python - 无法让 ObjectProperty 在 python 中与 Kivy 一起使用
- python - 如何将多个 csv 文件中的列连接/连接到 1 个 DataFrame() 中?
- javascript - 嵌套 Accordian:子元素在父元素后面打开
- python - 列表追加 MemoryError
- diff - 在 Beyond Compare 中比较 Json 文件
- python - 依赖冲突,featexp 0.0.5 有需求 numpy==1.15.4,pydeck 0.3.0b2 有需求 numpy>=1.16.4
- sql - SELECT 和 JOIN 只为每个员工返回一行
- makefile - 有什么方法可以将makefile扩展为新的makefile
- php - 如何在使用动态字段 Laravel 的数据库中插入和删除记录?
- c++ - C++ 通过引用接收函数返回