Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Seaborn散射图大小和抖动_Python_Jupyter Notebook_Seaborn - Fatal编程技术网

Python Seaborn散射图大小和抖动

Python Seaborn散射图大小和抖动,python,jupyter-notebook,seaborn,Python,Jupyter Notebook,Seaborn,我有下面的散点图代码 dimens = (12, 10) fig, ax = plt.subplots(figsize=dimens) sns.scatterplot(data = information, x = 'latitude', y = 'longitude', hue="genre", s=200, x_jitter=4, y_jitter=4, ax=ax) 无论我将抖动更改为什么,绘图仍然非常接近。怎么了 数据帧示例: st

我有下面的散点图代码

dimens = (12, 10)
fig, ax = plt.subplots(figsize=dimens)
sns.scatterplot(data = information, x = 'latitude', y = 'longitude', hue="genre", s=200,
                x_jitter=4, y_jitter=4, ax=ax)
无论我将抖动更改为什么,绘图仍然非常接近。怎么了

数据帧示例:

 store      longitude       latitude      genre
mcdonalds    140.232323      40.434343     all
kfc          140.232323      40.434343     chicken
burgerking   138.434343      35.545433     burger
fiveguys     137.323984      36.543322     burger

参数
s=200
将单个散射点设置为非常大的尺寸。 与之相比,增加4点抖动是非常小的。

在中,它写道:

{x,y}_jitterbooleans或float当前不起作用

您可以添加新列,也可以动态添加:

import seaborn as sns
import pandas as pd
import numpy as np

information = pd.DataFrame({'store':['mcdonalds','kfc','burgerking','fiveguys'],
                   'longitude':[140.232323,140.232323,138.434343,137.323984],
                   'latitude':[40.434343,40.434343,35.545433,36.543322],
                   'genre':['all','chicken','burger','burger']})

def jitter(values,j):
    return values + np.random.normal(j,0.1,values.shape)

sns.scatterplot(x = jitter(information.latitude,2), 
                y = jitter(information.longitude,2),
                hue=information.genre,s=200,alpha=0.5)

请分享一些数据,以便我们自己尝试。我添加了一个数据框。我降低了我的s,但同样的问题仍然存在。我添加了一个数据帧。