相关疑难解决方法(0)

seaborn/matplotlib中的散点图,其中点大小和颜色由连续数据帧列给出

我想在seaborn/matplotlib中制作一个散点图,其中点的大小由数据帧中的(连续)值确定,点的颜色也由数据帧中另一列的连续值确定.在ggplot中,这样做的方法是:

ggplot(iris) + geom_point(aes(x=Sepal.Width, y=Sepal.Length, size=Petal.Width, color=Petal.Length))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 (这里的颜色/尺寸是连续的非分类值)

seaborn/matplotlib中的语法是什么?

python matplotlib pandas

6
推荐指数
1
解决办法
5810
查看次数

Seaborn Jointplot为每个班级添加颜色

我想使用seaborn绘制2个变量的相关图jointplot。我尝试了很多不同的方法,但是我无法根据班级在点上添加颜色。

这是我的代码:

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set()

X = np.array([5.2945 , 3.6013 , 3.9675 , 5.1602 , 4.1903 , 4.4995 , 4.5234 ,
              4.6618 , 0.76131, 0.42036, 0.71092, 0.60899, 0.66451, 0.55388,
              0.63863, 0.62504, 0.     , 0.     , 0.49364, 0.44828, 0.43066,
              0.57368, 0.     , 0.     , 0.64824, 0.65166, 0.64968, 0.     ,
              0.     , 0.52522, 0.58259, 1.1309 , 0.     , 0.     , 1.0514 ,
              0.7519 , 0.78745, 0.94873, 1.0169 , 0.     , …
Run Code Online (Sandbox Code Playgroud)

python matplotlib scatter-plot seaborn

5
推荐指数
2
解决办法
2073
查看次数

标签 统计

matplotlib ×2

python ×2

pandas ×1

scatter-plot ×1

seaborn ×1