import matplotlib.pyplot as plt
import numpy as np
import pytensor.tensor as pt
import pytensor.xtensor as ptx
from pymc_marketing.mmm.transformers import root_saturation
alpha = np.array([0.1, 0.3, 0.5, 0.7])
x_np = np.linspace(0, 5, 100)
x = ptx.as_xtensor(pt.as_tensor_variable(x_np), dims=('x',))
ax = plt.subplot(111)
for a in alpha:
    y = root_saturation(x, alpha=a).eval()
    plt.plot(x_np, y, label=f'alpha = {a}')
plt.xlabel('spend', fontsize=12)
plt.ylabel('f(spend)', fontsize=12)
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.show()