%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib as mpl
mpl.style.use('classic')
import glob
rc('text',usetex=True)
rc('font',**{'family':'serif','serif':['Times New Roman'],'size':14})#,'weight':'bold'})
rc('xtick',**{'labelsize':16})
rc('ytick',**{'labelsize':16})
rc('axes',**{'labelsize':18,'titlesize':18})
filenames = sorted(glob.glob("*.dmx"))
for i,filename in enumerate(filenames):
psr = filename.split(".")[0]
try:
ts,dms,errs = np.loadtxt(filename,unpack=True,usecols=(0,1,2))
except:
continue
plt.figure(figsize=(12,8))
plt.errorbar(ts,dms,yerr=errs,fmt='k.')
plt.title(r'%s'%psr.replace("-","$-$"))
plt.xlabel(r'$\mathrm{MJD}$')
plt.ylabel(r'$\mathrm{DMX~(pc~cm^{-3})}$')
plt.savefig("%s.png"%psr)
plt.show()