import matplotlib.pyplot as plt
import numpy as np
 
from Orange.data import Table
from orangecontrib.spectroscopy.data import getx
 
spectra = in_data.X
energy = getx(in_data) #This is specfic to getting data from Orange data files


#fig, ax = plt.subplots()
fig, (ax, ax2) = plt.subplots(1,2)     
#ax.plot(energy, spectra.T)
#for row in spectra:
#    ax.plot(energy, row)
ax.plot(energy, spectra[0], 'indigo', linewidth=1.0, label='collagen') #add label='label text' if you want to add a legend
 
ax.plot(energy, spectra[1], 'darkblue', linewidth=1.0, label='glycogen') #add label='label text' if you want to add a legend 
 
ax2.plot(energy, spectra[2], 'blue', linewidth=1.0, label='lipids') #add label='label text' if you want to add a legend 
 
#add title
title = ax.set_title('Plot: Three Spectra, two plots',fontsize='10', loc='left') #  location = centre, left, right (default is centre)
 
 
#add axis labels for left plot
ax.set_xlabel('Wavenumber / cm$^{-1}$', fontsize='12')
ax.set_ylabel('Absorbance', fontsize='12')

#add axis labels for right plot
ax2.set_xlabel('Wavenumber / cm$^{-1}$', fontsize='12')
#ax2.set_ylabel('Absorbance', fontsize='12')
 
#set axis limits -->can  use to reverse axis for IR spectra
ax.set(xlim=(1850, 850)) #this is the wavenumber region you want to show
ax.set(ylim=(0,1.1)) #this is the absorbance range

#set axis limits  for right plot 
ax2.set(xlim=(1850, 850)) #this is the wavenumber region you want to show
ax2.set(ylim=(0,1.1)) #this is the absorbance range
 
 
ax.legend() #if you added label text you need this to make a legend
ax2.legend()

plt.show()