import matplotlib.pyplot as plt
from marvin.tools import Maps
plt.style.use('seaborn-v0_8-darkgrid')

maps = Maps('1-209232')
spax = maps.getSpaxel(x=0, y=0, xyorig='center', cube=True, modelcube=True)

fig, ax = plt.subplots()

pObs = ax.plot(spax.flux.wavelength, spax.flux.value)
pModel = ax.plot(spax.full_fit.wavelength, spax.full_fit.value)
pEmline = ax.plot(spax.emline_fit.wavelength, spax.emline_fit.value)
plt.legend(pObs + pEmline + pModel, ['observed', 'emline model', 'model'])

ax.axis([6700, 7100, -0.1, 3])
ax.set_xlabel('observed wavelength [{}]'.format(spax.flux.wavelength.unit.to_string('latex')))
ax.set_ylabel('flux [{}]'.format(spax.flux.unit.to_string('latex')))