不同参数的多个散点图

2024-05-13 01:28:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在努力在一个图表上为数据框中的一组数据绘制不同的散点图,这样它就可以显示不同物业类型的价格与面积:住宅、商业和工业。你知道吗

数据帧当前如下所示:

property_type   area    actual_worth    
Commercial      59.92   161250.0
Commercial      50.00   160000.0
Residential     40.50   123400.0
Industrial      35.49   61250.0
Industrial      24.30   125000.0
Commercial      90.12   69700.0 

谢谢你


Tags: 数据类型type图表绘制价格areaproperty
1条回答
网友
1楼 · 发布于 2024-05-13 01:28:27

您应该查看^{}以便于控制这些类型的绘图。你知道吗

下面是一个基于您的示例数据的非常简单的示例:

import seaborn as sns

g = sns.FacetGrid(df, row='property_type')
g.map(sns.scatterplot, 'area', 'actual_worth')

enter image description here

相关问题 更多 >