import numpy as np
import matplotlib.pyplot as plt



def bands_plot(domain, bands, ax=None, which=[(1.0, 99.0), (12.5, 87.5)]):
    if ax == None:
        fig, ax = plt.subplots(figsize=(10,10))
    
    for j, pair in enumerate(which):
        alpha = (100 - (pair[1]-pair[0]))/100
        alpha *= 0.5
        alpha += 0.3
        ax.fill_between(domain, bands[pair[0]], bands[pair[1]], alpha=alpha, color="blue", label="{:.0f}% CI".format((pair[1]-pair[0])))
    
    ax.plot(domain, bands[50.0], label="Median", color="blue", alpha=1.0)
    
    if ax == None:
        return fig, ax
    else:
        pass
import numpy as np
import matplotlib.pyplot as plt



def bands_plot(domain, bands, ax=None, which=[(1.0, 99.0), (12.5, 87.5)]):
    if ax == None:
        fig, ax = plt.subplots(figsize=(10,10))
    
    for j, pair in enumerate(which):
        alpha = (100 - (pair[1]-pair[0]))/100
        alpha *= 0.5
        alpha += 0.3
        ax.fill_between(domain, bands[pair[0]], bands[pair[1]], alpha=alpha, color="blue", label="{:.0f}% CI".format((pair[1]-pair[0])))
    
    ax.plot(domain, bands[50.0], label="Median", color="blue", alpha=1.0)
    
    if ax == None:
        return fig, ax
    else:
        pass