Rafael Paulino
Rafael Paulino

Reputation: 77

Setting markers colour on seaborn

everybody,

I am trying to do an lmplot but I want for the markers to differ between them only in format, not colour. I want them all to be black. I also tried to use a grey-scale palette such as 'Greys' or 'binary', but then some markers get very light, if there is a way of making them more apparent I'd also take it! I am using lmplot with fit_reg=False just because I'd like to use hue and as far as I know scatter does not have that function. The code I am using is:

sns.set_style("whitegrid")
sns.lmplot(data=data,x='Day',y='Temperature',hue='Site',fit_reg=False,markers=['o','+','x','s','p']).fig.set_size_inches(15,5)

And this is the resulting figure (ignore the black background): enter image description here

Thanks!

Upvotes: 3

Views: 7592

Answers (2)

Sandee007
Sandee007

Reputation: 341

palette should be used here. It supports multiple values just as markers.

palette=["red", "green", "blue", "orange", "purple"]

sns.set_style("whitegrid")
sns.lmplot(
data=data,
x='Day',
y='Temperature',
hue='Site',
fit_reg=False,
markers=['o','+','x','s','p'],
palette=["red", "green", "blue", "orange", "purple"]
).fig.set_size_inches(15,5)

Upvotes: 0

ImportanceOfBeingErnest
ImportanceOfBeingErnest

Reputation: 339540

The color is determined through the palette keyword. You may use a "palette" of only one color.

sns.lmplot(data=data,x='Day', y='Temperature', hue='Site', 
           palette=["black"], markers=['o','+','x','s','p'])

Upvotes: 6

Related Questions