how to generate the shaded regions with matplotlib
<p>I was trying to get the figure 5 in this <a href="http://pubs.rsc.org/en/content/articlepdf/2016/sc/c5sc02678d" rel="nofollow noreferrer">paper</a> but I couldn't generate two shaded regions that indicate the errors of 1 and 2 kcal/mol. Each shaded region must be in a different color as in paper. How can I do that?</p>
<p><strong>My code:</strong></p>
<pre><code>#!/usr/bin/python
import numpy as np
import pylab as plot
import matplotlib.pyplot as plt
import numpy, scipy, pylab, random
from matplotlib.ticker import MultipleLocator
import matplotlib as mpl
from matplotlib.ticker import MaxNLocator

color = &quot;#252525&quot;
gray = &quot;#777777&quot;

with open(&quot;input.txt&quot;, &quot;r&quot;) as f:
    x=[]
    y=[]
    z=[]
    
    for line in f:
        if not line.strip() or line.startswith('@') or line.startswith('#'): continue
        row = line.split()
        x.append(float(row[0]))
        y.append(float(row[1]))
        z.append(float(row[2]))
    

fig = plt.figure(figsize=(3.2,2.2), dpi=300)
ax = plt.subplot(111)

    
plt.xlim(-2, -12)
plt.ylim(-2, -12)
ax.xaxis.set_major_locator(MaxNLocator(6))
ax.yaxis.set_major_locator(MaxNLocator(6))

ax.xaxis.set_minor_locator(MultipleLocator(1))
ax.yaxis.set_minor_locator(MultipleLocator(1))

plt.plot(x,y,'o',color=&quot;black&quot;, ms=3, mec=&quot;black&quot;)
plt.plot(x,z, color='gray' , linestyle = &quot;dashed&quot;, dashes=(2,2))
        
plt.xlabel('Experimental (kcal/mol)', fontsize=8)
plt.ylabel('Predicted (kcal/mol)', fontsize=8)

for axis in ['top','bottom','left','right']:
  ax.spines[axis].set_linewidth(0.5)

plt.subplots_adjust(top=0.95)
plt.subplots_adjust(bottom=0.18)
plt.subplots_adjust(left=0.14)
plt.subplots_adjust(right=0.95)


plt.tick_params(axis='both', which='major', labelsize=7)
plt.tick_params(axis='both', which='minor', labelsize=0)
    
plt.savefig(&quot;output.png&quot;, dpi=300)
</code></pre>
<p><strong>Input file:</strong></p>
<pre><code>-2      -2.0    -2
-3      -3.5    -3
-4      -5.0    -4
-5      -7.0    -5
-6      -6.0    -6
-8      -10.1   -8
-10     -10.0   -10
-12     -12.0   -12
</code></pre>
<p><strong>Obtained output:</strong></p>
<p><a href="https://i.stack.imgur.com/Z16x9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z16x9.png" alt="enter image description here" /></a></p>