Pablo Pablo - 1 year ago 156
Python Question

Color underplot of tsplot

I'd like to color the lower part of a

in Seaborn. I have the following code:


Is it possible to color the lower area of the plot? I tried using
, but my data is too large so it just doesn't look right. Any advice?

Answer Source

Try to use fill_between from matplotlib, like here:

import numpy as np; np.random.seed(22)
import seaborn as sns; sns.set(color_codes=True)
import matplotlib.pylab as plt
x = np.arange(31)
data = np.sin(x) + np.random.rand(10, 31) + np.random.randn(10, 1)
ax = plt.gca()
ax.fill_between(x, np.sin(x), ax.get_ylim()[0], color='r')

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download