amc
amc

Reputation: 833

Change the marker of stripplot seaborn to be a string, not a marker

I have a pandas dataframe like this:

NAME POSITION VALUE
A 123 0.1
B 34 0.8

If I create a plot with stripplot, is there a way to have the dots actually be the corresponding values in NAME?

For example, the plot on the tutorial (https://stanford.edu/~mwaskom/software/seaborn/tutorial/categorical.html) shows this plot. Could those dots be replaced with the strings in another column, for example in "NAME"?

enter image description here

Upvotes: 4

Views: 983

Answers (2)

Anscandance
Anscandance

Reputation: 123

The correct answer is the following (just tested it on my stripplot I am working on)

sns.stripplot(data=yourdata, x=‘column_from_your_data’, size=2’)

Upvotes: 1

borgr
borgr

Reputation: 25265

For future reference, markers can be set to any string by Dollars($).

sns.lineplot(data,marker="$string$")

You should probably also play with markersize to make it prettier.

sns.lineplot(data,marker="$string$", markersize=10)

Upvotes: 0

Related Questions