如何更改 sns.scatterplot 上点的大小?

Sar*_*ara 1 python scatter-plot pandas seaborn

我想在我的点上绘制一个更大尺寸的图表,我已经尝试过sizes=100但它不起作用,

这是代码:

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

data = np.array([[1, 3, 'weekday'], [2, 2.5, 'weekday'],[3, 2.7, 'weekend'], [4, 2.8, 'weekend'], [5, 3, 'weekday'], [6, 3.1, 'weekday'], [7, 3, 'weekday'], [8, 3.1, 'weekday'], [9, 3.1, 'weekday'], [10, 3.1, 'weekend']])

# Creating a data frame with the raw data
dataset = pd.DataFrame(data, columns=['day', 'miles_walked', 'day_category'])

ax = sns.scatterplot(x='day', y='miles_walked', data=dataset, hue='day_category',sizes=100)
# Customize the axes and title
ax.set_title("Miles walked")
ax.set_xlabel("day")
ax.set_ylabel("total miles")
# Remove top and right borders
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

有人可以帮忙吗?非常感谢,

Ant*_*uis 6

您可以按如下方式使用s该函数的参数:sns.scatterplot

ax = sns.scatterplot(x='day', y='miles_walked', s=100, data=dataset, hue='day_category')
Run Code Online (Sandbox Code Playgroud)