I am following this example and I want to create larger bubbles but no matter how big I multiply the size column they are still tiny, is there some sort of scaling factor to adjust? I can't find it in the documentation.
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
ax = sns.scatterplot(x="total_bill", y="tip", data=tips)
cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
ax = sns.scatterplot(x="total_bill", y="tip",
hue="size", size="size",
palette=cmap,
data=tips)

tips['size'] = 100 * tips['size']
ax = sns.scatterplot(x="total_bill", y="tip",
hue="size", size="size",
palette=cmap,
data=tips)

Example code here
Apparently, you also need to use the sizes parameter in seaborn.scatterplot to achieve specified size range.
minsize = min(tips['size'])
maxsize = max(tips['size'])
ax = sns.scatterplot(x="total_bill", y="tip",
hue="size", size="size", sizes=(minsize, maxsize),
palette=cmap,
data=tips)

Thx for this method! it works great. I had the same issue when setting big size fig with a lot of data. scatter appeared so tiny I couldn't distinguish the size. so first set the tupple, the inject it into sns.scatter
btw, with this method you can play on minsize and maxsize with a multpiply factor without changing the actual data of size and thus the legend. I had to put minsize and maxsize to fifth power to make it readable! thank you so much!
minsize = min(df['value'])**5
maxsize = max(df['value'])**5
fx= sns.scatterplot(x=df['this'], y=df['that'], data=df, hue=df['takeway'], size=df['value'], sizes=(minsize, maxsize), legend='brief')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With