python - 散点图矩阵
问题描述
我想为我的所有矩阵绘制散点图。
我找到了 seaborn 模块,我做了这样的事情。
import seaborn as sns
data_ = pd.read_csv('/content/drive/My Drive/Colab Notebooks/Machine Learning/iris.csv', skiprows=1, delimiter=',')
sns.pairplot(data_)
我想知道如何给它颜色,就像这张图片一样。
另外我想知道是否有某种方法可以从 Matplotlib 中查看我的绘图矩阵,而无需一一制作。非常感谢!
更新:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'variety'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
4 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'variety'
解决方案
推荐阅读
- sql - Sqlite3 - 为什么 GLOB 不适用于 ^ $ 边界?
- python - 向 GOOGLE URL Shorteners API 发出 POST 请求
- python - FailedPreconditionError: 尝试使用未初始化的值 W
- android - APP可以在未经许可的情况下拍照?
- heroku - HEROKU - LetsEncrypt 在 Windows 中不安全,在 Mac 上可以吗?
- rank - 使用 Partition by 删除重复项
- wordpress - 如何捕获 WooCommerce webhook 交付并获得响应?
- assembly - 递归期间的堆栈帧外观。C 与汇编
- docker - Dockerfile - 可能的命令行参数?
- maven - maven插件执行问题