Plot Baseline Problem

"Stephen P. Molnar" <[email protected]>
Newsgroups gmane.comp.python.scientific.user
Message-ID <[email protected]>
I have attached code that I wrote to plot Infrared spectra. The x axis of
the plot (attached) runs from 400 to 4000, which is the range of the
infrared portion of the electromagnetic spectrum.

The spectrum of the sample runs from 400 to 2800.

My question is how can I expand the data plot from 2800 to 4000 (the
intensity is 0.0 in that range)?  Of course this is not the case for each
spectrum

The only thing I've found via Google is
https://stackoverflow.com/questions/47190853/extend-baseline-of-stem-plot-
in-matplotlib-to-axis-limits.

I appreciate your assistance.

Thanks in advance.

Stephen P. Molnar, Ph.D.		Life is a fuzzy set
www.molecular-modeling.net		Stochastic and Multivariate
(614)312-7528 (c)
Skype: smolnar1

_______________________________________________
SciPy-User mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scipy-user
InfraredPlots_44a.py (application/octet-stream, 744 B)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
InfraredPlots.py

Copyright (c) 2018 Stephen P. Molnar, Ph.D.  All rights reserved.

"""
import numpy as np
import matplotlib.pyplot as plt

data = []
name = input("Enter Molecule ID: ")

name_in = name+'.jdx'
data = np.genfromtxt(name_in)

nu =[]
freq = []


'''
xmax=[]
req.max()=max(freq)
print(freq.max)
'''

freq = data[17:,0]
nu = data[17:,1]     

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(freq,nu)

ax.set_xlim(400,4000)
#baseline.set_xdata([0,1])

plt.xlabel('Frequency (cm$^{-1}$)')
plt.ylabel('Relative Intensity (I)')
plt.title("Molecule ${}$: Infrared Spectrum".format(name))

plt.plot()
plt.grid()

name_plt = name
fig.savefig(name_plt,bbox_inches='tight')
plt.show()
1.png (image/png, 20.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.