Here's the solution:
import numpy as np, matplotlib.pyplot as plt, seaborn as sns sns.set(style="whitegrid", color_codes=True) titanic = sns.load_dataset("titanic") data = titanic.groupby("deck").size()
Here's the conclusion: 
Note. Currently, the code assigns different (adjacent) colors to bars with the same height. (Not a problem on the sample chart.) Although it would be better to use the same color for bars with the same height, the resulting code is likely to make the basic idea less clear.
source share