6

I am trying to use the sequential color brewer palette of seaborn scatter plot, but it does not work properly. This is what I have done so far. I would appreciate any help.

import seaborn as sns
from random import randrange

y = [randrange(100) for i in range(50)]
x = [i for i in range(50)]
ax = sns.scatterplot(x=x, y=y, s=15, c=y, palette=sns.color_palette("YlOrBr", as_cmap=True))

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
fsrfyama
  • 325
  • 2
  • 13

1 Answers1

8

palette is tied to hue, so change c to hue:

ax = sns.scatterplot(x=x, y=y, s=15, hue=y, palette="YlOrBr", legend=False)

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
tdy
  • 36,675
  • 19
  • 86
  • 83