forked from RNL1/Melamine-Dataset
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
executable file
·94 lines (70 loc) · 2.45 KB
/
plot.py
File metadata and controls
executable file
·94 lines (70 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 19 12:03:52 2018
@author: r.nik
"""
import pickle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
# Read Data
pkl_file = open('Melamine_Dataset.pkl', 'rb')
data = pickle.load(pkl_file)
pkl_file.close()
# Get colormap
col = cm.get_cmap('viridis',4)
col = col.colors
f, axes = plt.subplots(2, 4, sharey='row')
c = tuple(col[0])
axes[0,0].plot(data['wn1'],data['R562']['X1'].T,Color=c)
axes[0,0].set_title('R562')
axes[0,0].xlim = (5400,6400)
axes[0,0].xaxis.set_major_locator(plt.FixedLocator([5600,5900,6200]))
axes[0,0].ylim = (0.5,2.5)
axes[0,0].grid()
axes[1,0].plot(data['wn2'],data['R562']['X2'].T, Color=c)
axes[1,0].set_xlim([6550,7050])
axes[1,0].xaxis.set_major_locator(plt.FixedLocator([6600,6800,7000]))
axes[1,0].ylim = (0.2,0.7)
axes[1,0].grid()
c = tuple(col[1])
axes[0,1].plot(data['wn1'],data['R568']['X1'].T,Color=c)
axes[0,1].set_title('R568')
axes[0,1].xlim = (5400,6400)
axes[0,1].xaxis.set_major_locator(plt.FixedLocator([5600,5900,6200]))
axes[0,1].ylim = (0.5,2.5)
axes[0,1].grid()
axes[1,1].plot(data['wn2'],data['R568']['X2'].T,Color=c)
axes[1,1].set_xlim([6550,7050])
axes[1,1].xaxis.set_major_locator(plt.FixedLocator([6600,6800,7000]))
axes[1,1].ylim = (0.2,0.7)
axes[1,1].grid()
c = tuple(col[2])
axes[0,2].plot(data['wn1'],data['R861']['X1'].T,Color=c)
axes[0,2].set_title('R861')
axes[0,2].xlim = (5400,6400)
axes[0,2].xaxis.set_major_locator(plt.FixedLocator([5600,5900,6200]))
axes[0,2].ylim = (0.5,2.5)
axes[0,2].grid()
axes[1,2].plot(data['wn2'],data['R861']['X2'].T,Color=c)
axes[1,2].set_xlim([6550,7050])
axes[1,2].xaxis.set_major_locator(plt.FixedLocator([6600,6800,7000]))
axes[1,2].ylim = (0.2,0.7)
axes[1,2].grid()
c = tuple(col[3])
axes[0,3].plot(data['wn1'],data['R862']['X1'].T,Color=c)
axes[0,3].set_title('R862')
axes[0,3].xlim = (5400,6400)
axes[0,3].xaxis.set_major_locator(plt.FixedLocator([5600,5900,6200]))
axes[0,3].ylim = (0.5,2.5)
axes[0,3].grid()
axes[1,3].plot(data['wn2'],data['R862']['X2'].T,Color=c)
axes[1,3].set_xlim([6550,7050])
axes[1,3].xaxis.set_major_locator(plt.FixedLocator([6600,6800,7000]))
axes[1,3].ylim = (0.2,0.7)
axes[1,3].grid()
# Some Customizations
f.add_subplot(111, frameon=False)
plt.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)
plt.xlabel('Wavenumber (1/cm)')
plt.ylabel('Absorbance (a.u.)')