Leockl
Leockl

Reputation: 2156

How to create a heatmap with dark purple

I am wanting to create a heatmap with dark purple as shown below:

darkpurple

Code:

import numpy as np
import seaborn as sns

np.random.seed(0)

uniform_data1 = np.random.rand(10, 12)

ax1 = sns.heatmap(uniform_data1, cbar_kws={'label': 'score1'}, cmap="BuPu")

I have tried cmap equal to "BuPu", "PuBu" or "Purples" but all didn't quite give me the right colour. Would really be nice if I could have the same purple colours as shown in the picture above.

Many thanks in advance.

Upvotes: 0

Views: 789

Answers (2)

WU ZHENWEI
WU ZHENWEI

Reputation: 56

import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt

np.random.seed(0)

uniform_data1 = np.random.rand(10, 12)

fig, ax1 = plt.subplots()
ax1 = sns.heatmap(uniform_data1, cbar_kws={'label': 'score1'}, cmap=sns.cubehelix_palette(8))
plt.show()

Output

I am not sure if sns.cubehelix_palette(8) is exact what you desire. You could look at seaborn's choosing color palettes page to find more options.

Upvotes: 2

Arne
Arne

Reputation: 10545

I think this is what you are looking for:

cmap=sns.cubehelix_palette()

heatmap

Upvotes: 1

Related Questions