0

I have monthly rain data from a list, where values are on the Y-axis and months on the X-axis.

This is my color palette:

sns.color_palette("crest", as_cmap=True)

enter image description here This is my code to barplot the data:

plt.figure(figsize=(8,4), tight_layout=True)
colors = sns.color_palette("crest") 

plt.bar(bocas_rain['Date'], bocas_rain['Pr'], color=colors)

plt.xlabel('Months')
plt.ylabel('Rain in mm')
plt.title('Rain in Bocas')
plt.show()

The result I am getting is this:

barplot

How can I make the highest values of my data match the dark blue colors from the palette?

Adi
  • 191
  • 7
  • `sns.color_palette` by default gives 6 colors. `sns.color_palette("crest", len(bocas_rain))` would take just enough colors. Note that you can simply call `sns.barplot(..., palette='crest')` to get everything more automatically. – JohanC Dec 10 '22 at 23:26

0 Answers0