- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图绘制一个 PairGrid
在对角线上使用密度估计,在上三角部分和下三角中的成对线性回归模型部分。这是我的数据文件:
df.head()
g = sns.PairGrid(df, hue="quality bin")
g = g.map_upper(sns.scatterplot)
g = g.map_lower(sns.lmplot)
g = g.map_diag(sns.kdeplot)
g = g.add_legend()
但是我得到这个错误:TypeError: lmplot() got an unexpected keyword argument 'label'
最佳答案
您很可能需要 sns.regplot()
,我认为 sns.lmplot()
中的方面正在搞砸。看看下面是否适合你:
import pandas as pd
import seaborn as sns
df = pd.read_csv("wine_dataset.csv")
df.columns
df = df[['fixed_acidity', 'volatile_acidity', 'citric_acid', 'residual_sugar','quality']]
df['quality'] = ['high' if i > 5 else 'low' for i in df['quality']]
g = sns.PairGrid(df, hue="quality")
g = g.map_upper(sns.scatterplot)
g = g.map_lower(sns.regplot,scatter_kws = {'alpha': 0.1,'s':3})
g = g.map_diag(sns.kdeplot)
g = g.add_legend()
关于python - 在 Seaborn PairGrid 中使用 lmplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61599587/
我正在使用泰坦尼克号数据集,并尝试针对分类变量生成一对数值变量图。我可以用 Seaborn 的 catplot绘制一个数字变量对一个分类变量的图: import seaborn as sns sns.
我有一个像这样的数据集(有点): f1 f2 f3 value 4 2 3 0.927252 1 3 0 0.153415 0 1 1
我有 7 个特征,我想绘制 2 个特征的所有组合。我想将这些数据可视化,如下所示。我可以通过在 matpltlib 中的子图之后添加子图来手动完成,但是有这个功能吗?这类情节有专门的名字吗? 谢谢 答
我有一个数据框,其中包含来自几个不同模型的土壤温度数据,我想为其创建一个散点图矩阵。数据框如下所示: dataframe structure 数据是按模型(或站)组织的,我还包括了几个列来区分冷季或暖
我正在使用 seaborn 进行绘图我正在使用 seaborn.PairGrid功能。这是创建 6 x 6 网格,其中对角线图是直方图,非对角线图是散点图。现在我想为每行图设置不同的 y 范围,并为每
我尝试过使用answer至 Hide Axis Titles in Seaborn ,它适用于 heatmap,但最终会得到两个图:第一个是没有轴标题的空网格,第二个是 PairGrid 但仍带有轴标
我对 seaborn Pairgrid 有点吃力。 假设我有一个这样的 Pairgrid: 如您所见,上三角图反射(reflect)了下三角图。我希望能够只绘制下三角图,但到目前为止我发现没有简单的方
是否有可以与 g.map_lower 或 g.map_upper 一起使用的 matplotlib 或 seaborn 图来获取为每个双变量图显示的相关系数,如下所示?手动映射 plt.text 以获
在下面的示例中,我如何使用 seaborn.PairGrid() 重现由 seaborn.pairplot() 创建的绘图?具体来说,我希望对角线分布跨越垂直轴。带有白色边框等的标记……也很棒。谢谢!
在 Jupyter Notebook 中,我正在使用 seaborn 结合 ipywidgets 可视化 Iris 数据集。这很好用,只是速度不是那么快,因为每次选择“versicolor”、“vir
我希望重现 that tutorial 中的 PairGrid 图,但在本地,我的条形图没有像教程中那样堆叠,我不知道如何让它们堆叠起来。 import seaborn as sns import m
我试图绘制一个 PairGrid 在对角线上使用密度估计,在上三角部分和下三角中的成对线性回归模型部分。这是我的数据文件: df.head() 这是我的代码: g = sns.PairGrid(df,
我正在做一个大 PairGrid图,我无法在图外设置图例(右侧)。 PairGrid似乎没有继承 legend_out FaceGrid 的选项.到目前为止,这是我的尝试,您可以看到图例与图重叠。 f
我正在尝试绘制与 seaborn 文档中描述的情况非常相似的情况 http://seaborn.pydata.org/tutorial/axis_grids.html#plotting-pairwis
取自documentation : >>> import matplotlib.pyplot as plt >>> import seaborn as sns; sns.set() >>> iris
我真的很喜欢 Seaborn 的 PairGrid 的功能.但是,我无法将子图 reshape 到令我满意的程度。例如,下面的代码将返回一个包含 1 列和 2 行的图形,反射(reflect) 1 个
我正在尝试在 Seaborn 网格中获取 hexbin 图。我有以下代码, # Works in Jupyter with Python 2 Kernel. %matplotlib inline im
在花了一些时间了解 PairGrid 功能的工作原理之后,我已经快成功了。下面是生成我想要的绘图的代码,但 histfunc 中缺少一个小细节。我想要的是对角线上绘制的直方图的标题。如何将数据框列名称
有没有一种方法可以轻松地为 Seaborn 对图中的每个子图添加轴标签?这与此有关 question但我不想添加刻度标签,而是想添加轴标签,因为我拥有的配对图是 9*9,我不想每次都向下滚动以检查列名
这是我努力绘制的 pairgrid 图,该图使用下部的 kdeplot 和 2 种色调: 我的脚本是: import seaborn as sns g = sns.PairGrid(df2,hue='
我是一名优秀的程序员,十分优秀!