-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlayground
48 lines (29 loc) · 1.47 KB
/
Playground
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
import matplotlib.pyplot as plt
from pandas import DataFrame
import numpy as np
from Utilities.FileOps import read_Excel_DF, process_MaterialPropertyDF
dataFile_path = r'Tests\Cengel_Formatted_Unified.xlsx'
# dataFile_worksheet = 'WaterUnified'
dataFile_worksheet = 'R134aUnified'
dataFile = read_Excel_DF(dataFile_path, worksheet=dataFile_worksheet, headerRow=1, skipRows=[0])
MaterialPropertyDF = process_MaterialPropertyDF(dataFile)
propertyNames = {'P': 'Pressure (kPa)',
'T': 'Temperature (°C)',
'h': 'Specific Enthalpy (kJ/kg)',
's': 'Specific Entropy (kJ/kgK)',
'u': 'Specific Internal Energy (kJ/kg)'}
def plot_scatter(x_parameter: str, y_parameter: str, color_parameter: str):
figure, axes = plt.subplots()
x_data, y_data, z_data = [], [], []
parameterLists = {x_parameter: x_data, y_parameter: y_data, color_parameter: z_data}
for rowIndex in MaterialPropertyDF.index:
for parameter in parameterLists:
parameterLists[parameter].append(float(MaterialPropertyDF.iloc[rowIndex][parameter]))
axes.scatter(x_data, y_data, c=z_data, cmap='gist_rainbow')
for parameter, axMethod in [(x_parameter, axes.set_xlabel), (y_parameter, axes.set_ylabel)]:
if parameter in propertyNames:
# setattr(plt, axMethod, propertyNames[parameter])
axMethod(propertyNames[parameter])
plt.show()
if __name__ == '__main__':
plot_scatter('s', 'T', 'P')