How to change the marker size in a swarmplot
Asked Answered
B

1

5

I would like to make the data points on my swarmplot larger. The code I have is:

sns.swarmplot(x="Heart", y="FirstPersonPronouns", hue="Speech", data=df)
sns.set_context("notebook", font_scale=1.8)

I have tried scatter_kws but get:

Attribute error: unknown property scatter_kws.
Blabbermouth answered 14/9, 2016 at 21:0 Comment(0)
A
9

From the swarmplot docstring:

Signature: seaborn.swarmplot(x=None, y=None, hue=None, data=None,
order=None, hue_order=None, split=False, orient=None, color=None, 
palette=None, size=5, edgecolor='gray', linewidth=0, ax=None,
**kwargs)
Docstring: Draw a categorical scatterplot with non-overlapping points.     
[snip]


Parameters
---------- 
x, y, hue : names of variables in ``data`` or vector data, optional
    Inputs for plotting long-form data. See examples for interpretation. 
data : DataFrame, array, or list of arrays, optional
    Dataset for plotting. If ``x`` and ``y`` are absent, this is
    interpreted as wide-form. Otherwise it is expected to be long-form. [snip]

And then:

size : float, optional
    Diameter of the markers, in points. (Although ``plt.scatter`` is used
    to draw the points, the ``size`` argument here takes a "normal"
    markersize and not size^2 like ``plt.scatter``.
Anglaangle answered 14/9, 2016 at 22:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.