-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stir_Research_2D_Contour_Plot.py
141 lines (113 loc) 路 4.46 KB
/
Stir_Research_2D_Contour_Plot.py
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 13 12:30:05 2019
@author: Shrishti D Hore
"""
#FOR ROTATIONAL SPEED
'''
import pandas as pd
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
df_xyz = pd.read_csv("C:\\Users\\Shrishti D Hore\\OneDrive\\Documents\\Stir_Research\\rotational_speed.csv", delimiter=",")
x = df_xyz.iloc[:,0].values
y = df_xyz.iloc[:,1].values
z = df_xyz.iloc[:,2].values
def plot_contour(x,y,z,resolution = 50,contour_method='linear'):
resolution = str(resolution)+'j'
X,Y = np.mgrid[min(x):max(x):complex(resolution), min(y):max(y):complex(resolution)]
points = [[a,b] for a,b in zip(x,y)]
Z = griddata(points, z, (X, Y), method=contour_method)
return X,Y,Z
X,Y,Z = plot_contour(x,y,z,resolution = 50,contour_method='linear')
with plt.style.context("dark_background"):
fig, ax = plt.subplots(figsize=(13,8))
ax.scatter(x,y, color="red", linewidth=1, edgecolor="ivory", s=50)
ax.set_title("Rotational Speed Contour")
ax.set_xlabel("Axial Force")
ax.set_ylabel("Rotational Speed")
ax.contourf(X,Y,Z)
#ax.contour(X,Y,Z)
'''
'''
#FOR WELDING SPEED
import pandas as pd
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
df_xyz = pd.read_csv("C:\\Users\\Shrishti D Hore\\OneDrive\\Documents\\Stir_Research\\Welding_speed.csv", delimiter=",")
x = df_xyz.iloc[:,0].values
y = df_xyz.iloc[:,1].values
z = df_xyz.iloc[:,2].values
def plot_contour(x,y,z,resolution = 50,contour_method='linear'):
resolution = str(resolution)+'j'
X,Y = np.mgrid[min(x):max(x):complex(resolution), min(y):max(y):complex(resolution)]
points = [[a,b] for a,b in zip(x,y)]
Z = griddata(points, z, (X, Y), method=contour_method)
return X,Y,Z
X,Y,Z = plot_contour(x,y,z,resolution = 50,contour_method='linear')
with plt.style.context("dark_background"):
fig, ax = plt.subplots(figsize=(13,8))
ax.scatter(x,y, color="red", linewidth=1, edgecolor="ivory", s=50)
ax.set_title("Welding Speed Contour")
ax.set_xlabel("Rotational Speed")
ax.set_ylabel("Welding Speed")
ax.contourf(X,Y,Z)
#ax.contour(X,Y,Z)
'''
#FOR AXIAL FORCE
'''
import pandas as pd
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
df_xyz = pd.read_csv("C:\\Users\\Shrishti D Hore\\OneDrive\\Documents\\Stir_Research\\Axial_Force.csv", delimiter=",")
x = df_xyz.iloc[:,0].values
y = df_xyz.iloc[:,1].values
z = df_xyz.iloc[:,2].values
def plot_contour(x,y,z,resolution = 50,contour_method='linear'):
resolution = str(resolution)+'j'
X,Y = np.mgrid[min(x):max(x):complex(resolution), min(y):max(y):complex(resolution)]
points = [[a,b] for a,b in zip(x,y)]
Z = griddata(points, z, (X, Y), method=contour_method)
return X,Y,Z
X,Y,Z = plot_contour(x,y,z,resolution = 50,contour_method='linear')
with plt.style.context("dark_background"):
fig, ax = plt.subplots(figsize=(13,8))
ax.scatter(x,y, color="red", linewidth=1, edgecolor="ivory", s=50)
ax.set_title("Axial Force Contour")
ax.set_xlabel("Welding Speed")
ax.set_ylabel("Axial Force")
ax.contourf(X,Y,Z)
#ax.contour(X,Y,Z)
'''
#FOR ALL DATA
'''
import pandas as pd
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
df_xyz = pd.read_csv("C:\\Users\\Shrishti D Hore\\OneDrive\\Documents\\Stir_Research\\corrosion_final_data.csv", delimiter=",")
x = df_xyz.iloc[:,0].values
y = df_xyz.iloc[:,1].values
z = df_xyz.iloc[:,2].values
def plot_contour(x,y,z,resolution = 50,contour_method='linear'):
resolution = str(resolution)+'j'
X,Y = np.mgrid[min(x):max(x):complex(resolution), min(y):max(y):complex(resolution)]
points = [[a,b] for a,b in zip(x,y)]
Z = griddata(points, z, (X, Y), method=contour_method)
return X,Y,Z
X,Y,Z = plot_contour(x,y,z,resolution = 50,contour_method='linear')
with plt.style.context("dark_background"):
fig, ax = plt.subplots(figsize=(13,8))
ax.scatter(x,y, color="red", linewidth=1, edgecolor="ivory", s=50)
ax.set_title("All Data Contour")
ax.set_xlabel("Rotational Speed")
ax.set_ylabel("Axial Force")
ax.contourf(X,Y,Z)
#ax.contour(X,Y,Z)
'''