Initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
3 395
|
||||
3.3 390
|
||||
3.9 387
|
||||
4.05 384
|
||||
4.5 380
|
||||
4.64 377
|
||||
5.4 368
|
||||
5.88 358
|
||||
6.07 349
|
||||
7.4 355
|
||||
8.1 400
|
||||
8.95 466
|
||||
9.5 539
|
||||
216
syncthing/sync/Coding Projects/Python/Plotting/Base/Base.py
Normal file
216
syncthing/sync/Coding Projects/Python/Plotting/Base/Base.py
Normal file
@@ -0,0 +1,216 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import random
|
||||
import ast
|
||||
|
||||
|
||||
# Getting Random Data for Examples
|
||||
random.seed(10)
|
||||
x = np.linspace(1,20,50)
|
||||
y1 = np.sin(x)
|
||||
y2 = np.e**(-0.5*x)
|
||||
num= np.random.random
|
||||
|
||||
|
||||
|
||||
def make_basic_single_plot(x:list, y:list, xlabel:str = 'X-Axis', ylabel:str ='Y-Axis', title:str = '', lcolor = ['black'],lstyle: list = ['solid']):
|
||||
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20,
|
||||
'axes.titlesize': 20,
|
||||
'axes.labelsize': 20,
|
||||
'xtick.labelsize': 20,
|
||||
'ytick.labelsize': 20,
|
||||
'legend.fontsize': 20,
|
||||
'figure.titlesize': 20,
|
||||
'figure.figsize': [10,10]
|
||||
})
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
ax.set_title(title)
|
||||
|
||||
if type(y)==np.ndarray:
|
||||
ax.plot(x,y, color=lcolor[0], linestyle=lstyle[0])
|
||||
|
||||
|
||||
if type(y[0])==np.ndarray:
|
||||
for i in range(len(y)):
|
||||
ax.plot(x,y[i], color=lcolor[i], linestyle=lstyle[i])
|
||||
#ax[i].set_color(lcolor[i])
|
||||
#ax[i.set_linestyle(lstyle[i])]
|
||||
|
||||
plt.show()
|
||||
print("Done")
|
||||
|
||||
|
||||
|
||||
def make_basic_single_plot_int(x,y):
|
||||
|
||||
#Set Base Styling
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20,
|
||||
'axes.titlesize': 20,
|
||||
'axes.labelsize': 20,
|
||||
'xtick.labelsize': 20,
|
||||
'ytick.labelsize': 20,
|
||||
'legend.fontsize': 20,
|
||||
'figure.titlesize': 20,
|
||||
'figure.figsize': [10,10]
|
||||
})
|
||||
|
||||
#Basic Inputs
|
||||
fig, ax = plt.subplots()
|
||||
title = input("Title: ")
|
||||
xlab = input("X-axis Label: ")
|
||||
ylab = input("Y-axis Label: ")
|
||||
size = input("Figure Size [w, h]: ")
|
||||
|
||||
#Set Labels
|
||||
if size!="def":
|
||||
plt.rcParams.update({'figure.figsize': ast.literal_eval(size)})
|
||||
ax.set_xlabel(xlab)
|
||||
ax.set_ylabel(ylab)
|
||||
ax.set_title(title)
|
||||
|
||||
#Ask for data and add to plot
|
||||
num = int(input("Number of Datasets: "))
|
||||
|
||||
if num==1:
|
||||
lc = input("Line Color: ")
|
||||
if lc=='def':
|
||||
lc='black'
|
||||
ls = input("Line Style (-,--,:,-.): ")
|
||||
lw = input("Line Width (def=1): ")
|
||||
if lw=='def':
|
||||
lw=1
|
||||
else:
|
||||
lw=float(lw)
|
||||
|
||||
ax.plot(x,y,color=lc,linestyle=ls,linewidth=lw)
|
||||
|
||||
if num>1:
|
||||
for i in range(num):
|
||||
dl = input("Data Label: ")
|
||||
#data = input("First Data Set ([[x],[y]]): ")
|
||||
#data = ast.literal_eval(data)
|
||||
lc = input("Line Color: ")
|
||||
if lc=='def':
|
||||
lc='black'
|
||||
ls = input("Line Style (-,--,:,-.): ")
|
||||
lw = input("Line Width (def=1): ")
|
||||
if lw=='def':
|
||||
lw=1
|
||||
else:
|
||||
lw=float(lw)
|
||||
|
||||
ax.plot(x[i],y[i],label=dl,color=lc,linestyle=ls,linewidth=lw)
|
||||
|
||||
ax.legend(loc='center', bbox_to_anchor=(0.5, 1.01), ncol=num, frameon=False)
|
||||
plt.tight_layout()
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
################################# BASIC PLOT CODE #################################
|
||||
|
||||
# Basic Styling
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20, # Fonts
|
||||
'axes.titlesize': 20, # |
|
||||
'axes.labelsize': 20, # V
|
||||
'xtick.labelsize': 20,
|
||||
'ytick.labelsize': 20,
|
||||
'legend.fontsize': 20,
|
||||
'figure.titlesize': 20,
|
||||
'figure.figsize': [10,10] # Figure Size
|
||||
})
|
||||
|
||||
# Figure Setup
|
||||
fig, ax = plt.subplots()
|
||||
title = '' # Title
|
||||
xlab = '' # X Label
|
||||
ylab = '' # Y Label
|
||||
ax.set_xlabel(xlab)
|
||||
ax.set_ylabel(ylab)
|
||||
ax.set_title(title, pad = 20) #pad controls distance to plot
|
||||
ax.spines['top'].set_visible(False) # Controls non axis borders
|
||||
ax.spines['right'].set_visible(False)
|
||||
|
||||
x_min = 0 # Axis Limits and Ticks
|
||||
x_max = 1
|
||||
x_step_maj = 1 #steps not division
|
||||
x_step_min = 1
|
||||
|
||||
y_min = 0
|
||||
y_max = 1
|
||||
y_step_maj = 1
|
||||
y_step_min = 1
|
||||
|
||||
ax.set_xlim(x_min,x_max) # X limits
|
||||
ax.set_xticks(np.arange(x_min,x_max,x_step_maj)) # X Major Ticks
|
||||
ax.set_xticks(np.arange(x_min,x_max,x_step_min), minor=True) # X Minor Ticks
|
||||
|
||||
ax.set_ylim(y_min,y_max) # Y limits
|
||||
ax.set_yticks(np.arange(y_min,y_max,y_step_maj)) # Y Major Ticks
|
||||
ax.set_yticks(np.arange(y_min,y_max,y_step_min),minor=True) # Y Minor Ticks
|
||||
|
||||
|
||||
ax.grid(True, which='major',alpha=0.5) # Turn On Major Grid
|
||||
ax.grid(True, which='minor',alpha=0.2) # Turn on Minor Grid
|
||||
# alpha controls transparency
|
||||
|
||||
###################### Single Line ######################
|
||||
x = []
|
||||
y = []
|
||||
|
||||
ax.plot(x,y,color='black',linestyle='-',linewidth='1')
|
||||
# Basic Line Styles: -, --, :, -.
|
||||
# Basic Colors: red, blue, green, purple, cyan, magenta, black, brown, etc
|
||||
# Can Specify Hex code for colors
|
||||
|
||||
ax.scatter(x,y,color='black',marker='o',size=20)
|
||||
# Many Markers: circle-'o', square-'s', triangle-'^',star-'*', x-'x'
|
||||
|
||||
plt.show()
|
||||
|
||||
###################### Multi Line ######################
|
||||
x = [[],[]] # List of Lists
|
||||
y = [[],[]] # List of Lists
|
||||
|
||||
#### Lists must be equal length ###
|
||||
|
||||
dl = [] # Data Labels (list)
|
||||
lc = [] # Line Color |
|
||||
ls = [] # Line Style |
|
||||
lw = [] # Line Width V
|
||||
a = [] # Transparency
|
||||
s = [] # Marker Size, 20 is default
|
||||
m = [] # Marker Type, 'o' is default
|
||||
# Use color-hex.com for color pallets
|
||||
# Common ones: Shades of Teal, Ocean Breezes By,Ppt Cv
|
||||
# Green Palette:
|
||||
'#002005'
|
||||
'#164f29'
|
||||
'#3b7639'
|
||||
'#638d66'
|
||||
'#b5c5b4'
|
||||
|
||||
for i in range(len(x)):
|
||||
ax.plot(x[i],y[i],label=dl[i],color=lc[i],linestyle=ls[i],linewidth=lw[i], alpha=a[i])
|
||||
#ax.scatter(x[i],y[i],label=dl[i],color=lc[i],marker=m[i],size=s[i])
|
||||
|
||||
ax.legend(loc='center', bbox_to_anchor=(0.5, 1.01), ncol=len(x), frameon=False, labelspacing=0.2, columnspacing=0.75,
|
||||
handlelength=0.75, handletextpad=0.3)
|
||||
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||
# labelspacing is for vertical spacing, column is for horizontal, handel is for line length, textpad is for handl eto text
|
||||
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
@@ -0,0 +1,121 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def get_data(filename):
|
||||
file = open(filename)
|
||||
title = file.readline()
|
||||
lines = file.readlines()
|
||||
x = []
|
||||
y = []
|
||||
x_shift = []
|
||||
y_shift = []
|
||||
for line in lines:
|
||||
line.strip()
|
||||
data = line.split()
|
||||
if float(data[0])<=180:
|
||||
x.append(float(data[0]))
|
||||
y.append(float(data[1]))
|
||||
else:
|
||||
x_shift.append(float(data[0])-360)
|
||||
y_shift.append(float(data[1]))
|
||||
|
||||
return x_shift+x, y_shift+y
|
||||
|
||||
x_meas, y_meas = get_data('Python/Plotting/Base/Measured_P.txt')
|
||||
x_sim, y_sim = get_data("Python/Plotting/Base/Simulated_P.txt")
|
||||
|
||||
for i in x_meas:
|
||||
print(i)
|
||||
################################# BASIC PLOT CODE #################################
|
||||
|
||||
# Basic Styling
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20, # Fonts
|
||||
'axes.titlesize': 20, # |
|
||||
'axes.labelsize': 20, # V
|
||||
'xtick.labelsize': 15,
|
||||
'ytick.labelsize': 15,
|
||||
'legend.fontsize': 15,
|
||||
'figure.titlesize': 20,
|
||||
'figure.figsize': [10,5] # Figure Size
|
||||
})
|
||||
|
||||
# Figure Setup
|
||||
fig, ax = plt.subplots()
|
||||
title = 'Cylinder Pressure Trace' # Title
|
||||
xlab = '' # X Label
|
||||
ylab = 'Pressure [Bar]' # Y Label
|
||||
ax.set_xlabel(xlab)
|
||||
ax.set_ylabel(ylab)
|
||||
ax.set_title(title, pad = 20) #pad controls distance to plot
|
||||
ax.spines['top'].set_visible(False) # Controls non axis borders
|
||||
ax.spines['right'].set_visible(False)
|
||||
|
||||
x_min = -180 # Axis Limits and Ticks
|
||||
x_max = 180
|
||||
x_step_maj = 1 #steps not division
|
||||
x_step_min = 1
|
||||
|
||||
y_min = 0
|
||||
y_max = 36
|
||||
y_step_maj = 5
|
||||
y_step_min = 1
|
||||
|
||||
ax.set_xlim(x_min,x_max) # X limits
|
||||
ax.set_xticks([-180,-90,0,90,180],['BDC','Intake/Compression','TDC','Exhaust/Expansion','BDC']) # X Major Ticks
|
||||
ax.set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
||||
|
||||
ax.set_ylim(y_min,y_max) # Y limits
|
||||
ax.set_yticks(np.arange(y_min,y_max,y_step_maj)) # Y Major Ticks
|
||||
# ax.set_yticks(np.arange(y_min,y_max,y_step_min),minor=True) # Y Minor Ticks
|
||||
|
||||
|
||||
ax.grid(True, which='major',alpha=0.5) # Turn On Major Grid
|
||||
ax.grid(True, which='minor',alpha=0.2) # Turn on Minor Grid
|
||||
# alpha controls transparency
|
||||
|
||||
###################### Single Line ######################
|
||||
# x = []
|
||||
# y = []
|
||||
|
||||
# ax.plot(x,y,color='black',linestyle='-',linewidth='1')
|
||||
# # Basic Line Styles: -, --, :, -.
|
||||
# # Basic Colors: red, blue, green, purple, cyan, magenta, black, brown, etc
|
||||
# # Can Specify Hex code for colors
|
||||
|
||||
# ax.scatter(x,y,color='black',marker='o',size=20)
|
||||
# # Many Markers: circle-'o', square-'s', triangle-'^',star-'*', x-'x'
|
||||
|
||||
# plt.show()
|
||||
|
||||
###################### Multi Line ######################
|
||||
x = [x_sim,x_meas] # List of Lists
|
||||
y = [y_sim,y_meas] # List of Lists
|
||||
|
||||
#### Lists must be equal length ###
|
||||
|
||||
dl = ['Simulated','Measured'] # Data Labels (list)
|
||||
lc = ['black','black'] # Line Color |
|
||||
ls = ['-','--'] # Line Style |
|
||||
lw = [2,2] # Line Width V
|
||||
a = [1,1] # Transparency
|
||||
s = [] # Marker Size, 20 is default
|
||||
m = [] # Marker Type, 'o' is default
|
||||
# Use color-hex.com for color pallets
|
||||
# Common ones: Shades of Teal, Ocean Breezes By,Ppt Cv
|
||||
|
||||
|
||||
|
||||
for i in range(len(x)):
|
||||
ax.plot(x[i],y[i],label=dl[i],color=lc[i],linestyle=ls[i],linewidth=lw[i], alpha=a[i])
|
||||
#ax.scatter(x[i],y[i],label=dl[i],color=lc[i],marker=m[i],size=s[i])
|
||||
|
||||
ax.legend(loc='center', bbox_to_anchor=(0.8,0.8), ncol=1, frameon=True,edgecolor='white',framealpha=1, labelspacing=0.2,
|
||||
columnspacing=0.75,handlelength=0.75, handletextpad=0.3)
|
||||
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||
# labelspacing is for vertical spacing, column is for horizontal, handel is for line length, textpad is for handl eto text
|
||||
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
360
syncthing/sync/Coding Projects/Python/Plotting/Base/Measured.txt
Executable file
360
syncthing/sync/Coding Projects/Python/Plotting/Base/Measured.txt
Executable file
@@ -0,0 +1,360 @@
|
||||
Measured
|
||||
0.62941825 1.4159249
|
||||
0.6292404 1.4162701
|
||||
0.62146497 1.4501166
|
||||
0.61364883 1.4846574
|
||||
0.6057943 1.5103542
|
||||
0.5979039 1.5425
|
||||
0.58998007 1.5685343
|
||||
0.58202535 1.59443
|
||||
0.57404226 1.6333632
|
||||
0.5660334 1.6624316
|
||||
0.5580015 1.6914659
|
||||
0.5499493 1.7277586
|
||||
0.5418794 1.7718027
|
||||
0.5337947 1.800122
|
||||
0.525698 1.820073
|
||||
0.51759225 1.864939
|
||||
0.50948024 1.9143927
|
||||
0.50136495 1.9424458
|
||||
0.49324933 1.9689004
|
||||
0.48513648 2.0007682
|
||||
0.47702935 2.0428734
|
||||
0.46893105 2.092996
|
||||
0.46084467 2.1401384
|
||||
0.4527733 2.1865857
|
||||
0.44472015 2.2368457
|
||||
0.43668833 2.285979
|
||||
0.42868105 2.3294344
|
||||
0.42070147 2.3846078
|
||||
0.41275287 2.4397848
|
||||
0.40483844 2.4869232
|
||||
0.39696145 2.5410275
|
||||
0.3891251 2.599124
|
||||
0.38133273 2.6664405
|
||||
0.37358752 2.7430947
|
||||
0.36589277 2.8212624
|
||||
0.35825172 2.9068794
|
||||
0.35066766 2.9896586
|
||||
0.34314382 3.0711071
|
||||
0.3356835 3.1559534
|
||||
0.32828987 3.2481284
|
||||
0.3209662 3.3423545
|
||||
0.3137157 3.4481862
|
||||
0.3065416 3.5555441
|
||||
0.299447 3.6477833
|
||||
0.29243514 3.7581906
|
||||
0.2855091 3.889259
|
||||
0.27867204 4.0075665
|
||||
0.27192703 4.1237774
|
||||
0.26527712 4.257856
|
||||
0.25872535 4.3807116
|
||||
0.2522747 4.49738
|
||||
0.24592812 4.6305895
|
||||
0.23968853 4.778136
|
||||
0.23355883 4.9141903
|
||||
0.22754185 5.046443
|
||||
0.22164036 5.1944184
|
||||
0.21585713 5.356183
|
||||
0.21019486 5.505464
|
||||
0.2046562 5.6514354
|
||||
0.19924374 5.813004
|
||||
0.19396004 5.978728
|
||||
0.18880758 6.1567254
|
||||
0.1837888 6.3394485
|
||||
0.17890608 6.51239
|
||||
0.17416175 6.682379
|
||||
0.16955803 6.872758
|
||||
0.16509715 7.0743103
|
||||
0.16078122 7.270871
|
||||
0.1566123 7.464198
|
||||
0.15259242 7.650001
|
||||
0.14872345 7.847092
|
||||
0.1450073 8.05476
|
||||
0.14144573 8.25817
|
||||
0.13804047 8.466103
|
||||
0.13479313 8.678619
|
||||
0.13170531 8.887357
|
||||
0.1287785 9.093097
|
||||
0.1260141 9.296996
|
||||
0.12341346 9.500862
|
||||
0.12097783 9.696824
|
||||
0.118708394 9.896242
|
||||
0.11660625 10.104578
|
||||
0.11467242 10.3127575
|
||||
0.11290786 10.516966
|
||||
0.111313395 10.735301
|
||||
0.10988983 10.967971
|
||||
0.10863784 11.187811
|
||||
0.10755804 11.409951
|
||||
0.10665096 11.649704
|
||||
0.10591704 11.915226
|
||||
0.105356626 12.229004
|
||||
0.10497 12.624488
|
||||
0.10475736 13.143764
|
||||
0.1047188 13.786082
|
||||
0.10485433 14.520525
|
||||
0.105163895 15.332433
|
||||
0.10564734 16.170528
|
||||
0.10630444 16.998716
|
||||
0.10713486 17.836205
|
||||
0.1081382 18.687443
|
||||
0.10931398 19.54697
|
||||
0.11066161 20.403082
|
||||
0.11218046 21.247686
|
||||
0.113869764 22.036057
|
||||
0.11572872 22.71839
|
||||
0.11775642 23.26616
|
||||
0.11995187 23.68012
|
||||
0.12231401 23.940948
|
||||
0.12484171 24.036562
|
||||
0.12753372 24.002546
|
||||
0.13038875 23.838465
|
||||
0.13340543 23.561995
|
||||
0.13658229 23.203642
|
||||
0.13991778 22.799614
|
||||
0.14341031 22.359493
|
||||
0.1470582 21.85754
|
||||
0.15085968 21.322016
|
||||
0.15481295 20.801252
|
||||
0.15891609 20.280685
|
||||
0.16316713 19.73843
|
||||
0.16756406 19.20285
|
||||
0.17210476 18.69489
|
||||
0.17678708 18.206665
|
||||
0.18160878 17.71212
|
||||
0.18656757 17.224617
|
||||
0.1916611 16.758638
|
||||
0.19688697 16.321344
|
||||
0.2022427 15.886558
|
||||
0.20772576 15.454157
|
||||
0.2133336 15.048209
|
||||
0.21906358 14.662399
|
||||
0.224913 14.274215
|
||||
0.23087916 13.895381
|
||||
0.23695928 13.534915
|
||||
0.24315053 13.182266
|
||||
0.24945007 12.846317
|
||||
0.255855 12.517049
|
||||
0.26236233 12.182421
|
||||
0.26896915 11.861401
|
||||
0.2756724 11.56014
|
||||
0.28246906 11.26839
|
||||
0.28935605 10.979116
|
||||
0.29633027 10.702868
|
||||
0.3033886 10.4279375
|
||||
0.3105279 10.14496
|
||||
0.31774494 9.877815
|
||||
0.3250366 9.626582
|
||||
0.3323996 9.373955
|
||||
0.3398308 9.122279
|
||||
0.34732687 8.878942
|
||||
0.35488465 8.648123
|
||||
0.36250088 8.421089
|
||||
0.37017223 8.19121
|
||||
0.37789547 7.972817
|
||||
0.38566738 7.772068
|
||||
0.39348465 7.5814505
|
||||
0.40134403 7.3918085
|
||||
0.40924227 7.201997
|
||||
0.41717616 7.010725
|
||||
0.42514238 6.825191
|
||||
0.4331378 6.6581683
|
||||
0.44115913 6.4980865
|
||||
0.44920325 6.3391433
|
||||
0.45726693 6.188291
|
||||
0.46534702 6.038029
|
||||
0.47344044 5.887462
|
||||
0.48154402 5.7555532
|
||||
0.48965472 5.633255
|
||||
0.49776947 5.5115786
|
||||
0.5058853 5.3980837
|
||||
0.5139991 5.292057
|
||||
0.522108 5.1872706
|
||||
0.5302091 5.084621
|
||||
0.53829944 4.98922
|
||||
0.5463762 4.9015737
|
||||
0.5544366 4.8137655
|
||||
0.5624779 4.7252154
|
||||
0.5704973 4.639823
|
||||
0.5784921 4.5569577
|
||||
0.5864597 4.4713645
|
||||
0.59439754 4.3851833
|
||||
0.6023031 4.3041406
|
||||
0.61017376 4.2280955
|
||||
0.6180072 4.1580935
|
||||
0.62580097 4.0861855
|
||||
0.63355273 4.0174384
|
||||
0.64126015 3.9544528
|
||||
0.648921 3.8897464
|
||||
0.6565331 3.8209789
|
||||
0.6640943 3.7516003
|
||||
0.67160255 3.680018
|
||||
0.67905575 3.604746
|
||||
0.686452 3.519643
|
||||
0.69378924 3.4237425
|
||||
0.7010657 3.3397286
|
||||
0.70827955 3.2586088
|
||||
0.715429 3.1583288
|
||||
0.7225123 3.048317
|
||||
0.72952783 2.9438803
|
||||
0.736474 2.8399181
|
||||
0.7433492 2.7352245
|
||||
0.75015193 2.626329
|
||||
0.7568808 2.5070345
|
||||
0.76353437 2.394028
|
||||
0.7701112 2.2937562
|
||||
0.77661014 2.1945186
|
||||
0.7830298 2.0955625
|
||||
0.7893691 1.9953909
|
||||
0.79562676 1.8912864
|
||||
0.8018018 1.7923512
|
||||
0.80789304 1.7011157
|
||||
0.8138995 1.6124156
|
||||
0.8198202 1.5277588
|
||||
0.82565427 1.4490067
|
||||
0.83140075 1.3761914
|
||||
0.8370588 1.310608
|
||||
0.84262764 1.2587739
|
||||
0.8481065 1.2086323
|
||||
0.85349464 1.1568456
|
||||
0.85879135 1.1058809
|
||||
0.8639961 1.0614659
|
||||
0.8691081 1.0355427
|
||||
0.8741268 1.0164967
|
||||
0.87905174 0.9934473
|
||||
0.88388234 0.9782406
|
||||
0.8886181 0.9687869
|
||||
0.8932586 0.9502075
|
||||
0.89780337 0.939276
|
||||
0.902252 0.9436065
|
||||
0.9066042 0.9387441
|
||||
0.9108595 0.9363957
|
||||
0.9150177 0.94382405
|
||||
0.9190784 0.95158124
|
||||
0.9230414 0.9563113
|
||||
0.92690635 0.9638647
|
||||
0.93067306 0.9823345
|
||||
0.9343413 1.0064347
|
||||
0.9379109 1.0193701
|
||||
0.94138163 1.0261184
|
||||
0.9447534 1.0512638
|
||||
0.94802594 1.0709031
|
||||
0.95119923 1.0724144
|
||||
0.9542731 1.0755404
|
||||
0.9572474 1.0784599
|
||||
0.96012205 1.0839422
|
||||
0.96289706 1.0826727
|
||||
0.9655722 1.0793967
|
||||
0.9681475 1.0930203
|
||||
0.9706229 1.0965391
|
||||
0.97299826 1.0801593
|
||||
0.97527367 1.0683249
|
||||
0.977449 1.0641904
|
||||
0.97952425 1.0710913
|
||||
0.9814994 1.0766206
|
||||
0.98337436 1.0752534
|
||||
0.98514926 1.0738416
|
||||
0.986824 1.0780787
|
||||
0.98839855 1.0755196
|
||||
0.98987293 1.0677567
|
||||
0.9912471 1.07067
|
||||
0.99252117 1.0804877
|
||||
0.9936951 1.087186
|
||||
0.9947688 1.085108
|
||||
0.9957423 1.0764151
|
||||
0.9966157 1.0731394
|
||||
0.99738896 1.0747122
|
||||
0.998062 1.0724411
|
||||
0.99863493 1.0737307
|
||||
0.9991078 1.0714661
|
||||
0.9994804 1.0624795
|
||||
0.99975294 1.0588353
|
||||
0.9999253 1.0537856
|
||||
0.99999756 1.0429349
|
||||
0.99996966 1.0294797
|
||||
0.99984163 1.0180243
|
||||
0.99961346 1.0149299
|
||||
0.9992852 1.0157316
|
||||
0.9988568 1.0111974
|
||||
0.9983282 1.0000876
|
||||
0.9976995 0.9917807
|
||||
0.9969706 0.98949444
|
||||
0.9961416 0.994161
|
||||
0.99521244 0.9889599
|
||||
0.99418306 0.98513174
|
||||
0.99305356 0.98472893
|
||||
0.9918239 0.9852653
|
||||
0.9904941 0.98835295
|
||||
0.98906404 0.98572445
|
||||
0.98753387 0.97893834
|
||||
0.98590356 0.97510475
|
||||
0.984173 0.9793767
|
||||
0.98234236 0.980711
|
||||
0.9804116 0.97125703
|
||||
0.9783807 0.9688899
|
||||
0.9762497 0.96881396
|
||||
0.97401863 0.9613243
|
||||
0.97168756 0.9593919
|
||||
0.96925646 0.9597825
|
||||
0.9667254 0.9600472
|
||||
0.96409446 0.9599489
|
||||
0.96136373 0.95407695
|
||||
0.9585332 0.9495246
|
||||
0.955603 0.9517564
|
||||
0.95257324 0.95214516
|
||||
0.949444 0.9542315
|
||||
0.94621545 0.9468051
|
||||
0.9428876 0.93094957
|
||||
0.9394607 0.9314543
|
||||
0.9359349 0.93752885
|
||||
0.9323103 0.9322266
|
||||
0.9285872 0.941523
|
||||
0.9247657 0.962977
|
||||
0.9208461 0.9678459
|
||||
0.9168287 0.9650768
|
||||
0.91271365 0.975347
|
||||
0.9085013 0.98663884
|
||||
0.90419203 0.97771454
|
||||
0.89978606 0.97132206
|
||||
0.8952838 0.9768297
|
||||
0.8906857 0.9790908
|
||||
0.88599205 0.97367156
|
||||
0.8812034 0.9893024
|
||||
0.8763202 1.0251051
|
||||
0.87134296 1.0366
|
||||
0.8662722 1.0465263
|
||||
0.8611085 1.0848211
|
||||
0.8558525 1.1191703
|
||||
0.85050476 1.133844
|
||||
0.845066 1.148908
|
||||
0.8395369 1.1719776
|
||||
0.8339183 1.1929169
|
||||
0.8282109 1.213694
|
||||
0.82241553 1.2199512
|
||||
0.8165331 1.2246112
|
||||
0.81056446 1.2287027
|
||||
0.80451065 1.2308375
|
||||
0.7983726 1.2473023
|
||||
0.79215145 1.2606347
|
||||
0.7858482 1.2693243
|
||||
0.77946395 1.2727764
|
||||
0.773 1.2804279
|
||||
0.7664575 1.2882518
|
||||
0.75983775 1.2877786
|
||||
0.7531421 1.2806827
|
||||
0.7463719 1.2775594
|
||||
0.73952866 1.291898
|
||||
0.73261374 1.2868485
|
||||
0.72562873 1.2750502
|
||||
0.71857524 1.274958
|
||||
0.71145487 1.28322
|
||||
0.70426935 1.2869114
|
||||
0.6970204 1.2924124
|
||||
0.68970984 1.306109
|
||||
0.68233955 1.3148426
|
||||
0.6749113 1.319715
|
||||
0.66742724 1.3303853
|
||||
0.6598892 1.3407135
|
||||
0.6522994 1.3657143
|
||||
0.6446599 1.3912835
|
||||
359
syncthing/sync/Coding Projects/Python/Plotting/Base/Measured_P.txt
Executable file
359
syncthing/sync/Coding Projects/Python/Plotting/Base/Measured_P.txt
Executable file
@@ -0,0 +1,359 @@
|
||||
-92.0 1.49994
|
||||
-91.045 1.5358741
|
||||
-90.04221 1.5747739
|
||||
-89.03943 1.6015724
|
||||
-88.036644 1.6340126
|
||||
-87.03386 1.670783
|
||||
-86.03107 1.6916652
|
||||
-85.02828 1.7275078
|
||||
-84.0255 1.7654344
|
||||
-83.02271 1.7854145
|
||||
-82.01993 1.8194822
|
||||
-81.01714 1.8705827
|
||||
-80.01436 1.9102426
|
||||
-79.01157 1.9390588
|
||||
-78.00879 1.9744704
|
||||
-77.006004 2.0226028
|
||||
-76.00321 2.0527759
|
||||
-75.00043 2.0764947
|
||||
-73.99764 2.113165
|
||||
-72.99486 2.1565006
|
||||
-71.99207 2.203957
|
||||
-70.98929 2.239184
|
||||
-69.9865 2.2730813
|
||||
-68.98372 2.3118153
|
||||
-67.980934 2.346297
|
||||
-66.97815 2.3983858
|
||||
-65.97536 2.466354
|
||||
-64.97257 2.5162356
|
||||
-63.969788 2.5553286
|
||||
-62.967003 2.6157835
|
||||
-61.96422 2.679005
|
||||
-60.961433 2.7451425
|
||||
-59.95865 2.801526
|
||||
-58.95586 2.8587923
|
||||
-57.953075 2.928777
|
||||
-56.95029 3.0244718
|
||||
-55.947506 3.122418
|
||||
-54.94472 3.2025068
|
||||
-53.941933 3.296004
|
||||
-52.939148 3.404564
|
||||
-51.936363 3.516928
|
||||
-50.93358 3.6313565
|
||||
-49.930794 3.746737
|
||||
-48.928005 3.8704386
|
||||
-47.92522 4.016033
|
||||
-46.922436 4.1591654
|
||||
-45.91965 4.297891
|
||||
-44.916866 4.450213
|
||||
-43.914078 4.6128554
|
||||
-42.911293 4.773245
|
||||
-41.90851 4.9438257
|
||||
-40.905724 5.123311
|
||||
-39.902935 5.3002
|
||||
-38.90015 5.4819884
|
||||
-37.897366 5.668606
|
||||
-36.89458 5.8655744
|
||||
-35.891796 6.0592184
|
||||
-34.889008 6.2564006
|
||||
-33.886223 6.462807
|
||||
-32.88344 6.680519
|
||||
-31.880653 6.9080825
|
||||
-30.877867 7.129336
|
||||
-29.875082 7.3426743
|
||||
-28.872295 7.566285
|
||||
-27.86951 7.79594
|
||||
-26.866726 8.017852
|
||||
-25.86394 8.238896
|
||||
-24.861155 8.469887
|
||||
-23.858368 8.697036
|
||||
-22.855583 8.919875
|
||||
-21.852798 9.14525
|
||||
-20.850012 9.366462
|
||||
-19.847227 9.588287
|
||||
-18.84444 9.806462
|
||||
-17.841656 10.018648
|
||||
-16.83887 10.227453
|
||||
-15.836084 10.433891
|
||||
-14.833299 10.642883
|
||||
-13.830514 10.844865
|
||||
-12.827728 11.036104
|
||||
-11.824943 11.228933
|
||||
-10.822157 11.428449
|
||||
-9.819371 11.631645
|
||||
-8.816586 11.834167
|
||||
-7.8138003 12.05777
|
||||
-6.8110147 12.308648
|
||||
-5.8082294 12.583031
|
||||
-4.805444 12.89164
|
||||
-3.8026583 13.239749
|
||||
-2.7998729 13.652845
|
||||
-1.7970873 14.241348
|
||||
-0.7943018 15.097665
|
||||
0.20848373 16.156034
|
||||
1.2112693 17.311827
|
||||
2.2140548 18.629465
|
||||
3.2168403 20.182745
|
||||
4.219626 21.867989
|
||||
5.222411 23.652916
|
||||
6.225197 25.57259
|
||||
7.2279825 27.519611
|
||||
8.230768 29.343184
|
||||
9.233553 30.930952
|
||||
10.236339 32.23247
|
||||
11.239124 33.238777
|
||||
12.24191 33.993977
|
||||
13.244696 34.477142
|
||||
14.247481 34.611588
|
||||
15.250266 34.398136
|
||||
16.253052 33.894115
|
||||
17.255838 33.221287
|
||||
18.258623 32.43608
|
||||
19.261408 31.547655
|
||||
20.264194 30.601032
|
||||
21.26698 29.644505
|
||||
22.269766 28.675808
|
||||
23.27255 27.696926
|
||||
24.275335 26.731478
|
||||
25.278122 25.764727
|
||||
26.280907 24.819464
|
||||
27.283693 23.934162
|
||||
28.286478 23.070627
|
||||
29.289263 22.225868
|
||||
30.29205 21.424213
|
||||
31.294834 20.662178
|
||||
32.29762 19.936192
|
||||
33.300407 19.242838
|
||||
34.303192 18.5975
|
||||
35.305977 17.98772
|
||||
36.30876 17.396982
|
||||
37.311546 16.828587
|
||||
38.314335 16.285591
|
||||
39.31712 15.777186
|
||||
40.319904 15.303992
|
||||
41.32269 14.858357
|
||||
42.325474 14.424688
|
||||
43.328262 14.006265
|
||||
44.331047 13.608196
|
||||
45.33383 13.23071
|
||||
46.336617 12.866277
|
||||
47.3394 12.509645
|
||||
48.34219 12.166203
|
||||
49.344975 11.841009
|
||||
50.34776 11.5273485
|
||||
51.350544 11.2272
|
||||
52.35333 10.9426985
|
||||
53.356117 10.668935
|
||||
54.358902 10.400414
|
||||
55.361687 10.140384
|
||||
56.36447 9.890146
|
||||
57.36726 9.642134
|
||||
58.370045 9.404908
|
||||
59.37283 9.175018
|
||||
60.375614 8.949436
|
||||
61.3784 8.737044
|
||||
62.381187 8.543196
|
||||
63.383972 8.35779
|
||||
64.38676 8.169585
|
||||
65.38954 7.9846306
|
||||
66.39233 7.813252
|
||||
67.39511 7.656072
|
||||
68.397896 7.4997406
|
||||
69.40068 7.335511
|
||||
70.40347 7.1682205
|
||||
71.40626 7.007455
|
||||
72.40904 6.8548517
|
||||
73.41183 6.7021093
|
||||
74.41461 6.562641
|
||||
75.4174 6.442068
|
||||
76.42018 6.3234425
|
||||
77.422966 6.2064185
|
||||
78.42575 6.0916553
|
||||
79.42854 5.9737186
|
||||
80.43133 5.855297
|
||||
81.43411 5.742545
|
||||
82.4369 5.6421056
|
||||
83.43968 5.5450706
|
||||
84.44247 5.4420176
|
||||
85.44525 5.343885
|
||||
86.44804 5.242539
|
||||
87.45082 5.1345644
|
||||
88.453606 5.0409527
|
||||
89.4564 4.950507
|
||||
90.45918 4.8487654
|
||||
91.46197 4.7431936
|
||||
92.46475 4.64871
|
||||
93.46754 4.5707674
|
||||
94.47032 4.4867187
|
||||
95.47311 4.3956923
|
||||
96.47589 4.308978
|
||||
97.478676 4.2200656
|
||||
98.48146 4.121357
|
||||
99.48425 4.004675
|
||||
100.48704 3.876544
|
||||
101.48982 3.749862
|
||||
102.49261 3.6186206
|
||||
103.49539 3.480858
|
||||
104.49818 3.3373597
|
||||
105.50096 3.1904325
|
||||
106.503746 3.0482006
|
||||
107.50653 2.9068234
|
||||
108.50932 2.7632055
|
||||
109.51211 2.621736
|
||||
110.51489 2.4763553
|
||||
111.51768 2.33616
|
||||
112.52046 2.219924
|
||||
113.52325 2.1094823
|
||||
114.52603 1.9892626
|
||||
115.52882 1.8689619
|
||||
116.5316 1.7576358
|
||||
117.534386 1.6642258
|
||||
118.53718 1.5729184
|
||||
119.53996 1.4829215
|
||||
120.54275 1.4054621
|
||||
121.54553 1.3275464
|
||||
122.54832 1.2654024
|
||||
123.5511 1.2165117
|
||||
124.55389 1.1615419
|
||||
125.55667 1.1109456
|
||||
126.559456 1.0769604
|
||||
127.56224 1.055147
|
||||
128.56503 1.0252388
|
||||
129.56781 0.9901923
|
||||
130.5706 0.96990806
|
||||
131.57338 0.95258635
|
||||
132.57617 0.9336768
|
||||
133.57896 0.9253882
|
||||
134.58174 0.91230047
|
||||
135.58453 0.90129495
|
||||
136.58731 0.9054593
|
||||
137.5901 0.91190815
|
||||
138.59288 0.909744
|
||||
139.59567 0.90060055
|
||||
140.59845 0.89651513
|
||||
141.60124 0.9008918
|
||||
142.60403 0.9136557
|
||||
143.60681 0.9320812
|
||||
144.6096 0.94551986
|
||||
145.61238 0.9487948
|
||||
146.61517 0.9600983
|
||||
147.61795 0.9731612
|
||||
148.62074 0.97801316
|
||||
149.62352 0.9859535
|
||||
150.62631 0.9945002
|
||||
151.62909 1.0036399
|
||||
152.63188 1.0150312
|
||||
153.63467 1.0259724
|
||||
154.63745 1.0369852
|
||||
155.64024 1.0350384
|
||||
156.64302 1.0357995
|
||||
157.64581 1.0359021
|
||||
158.64859 1.0297711
|
||||
159.65138 1.0229367
|
||||
160.65416 1.0179937
|
||||
161.65695 1.013861
|
||||
162.65974 1.0129942
|
||||
163.66252 1.0114627
|
||||
164.66531 1.0127962
|
||||
165.66809 1.0171802
|
||||
166.67088 1.013339
|
||||
167.67366 1.0141994
|
||||
168.67645 1.0218638
|
||||
169.67923 1.0163764
|
||||
170.68202 1.0101875
|
||||
171.68481 1.0091355
|
||||
172.68759 1.0096533
|
||||
173.69038 1.008341
|
||||
174.69316 1.0026432
|
||||
175.69595 1.0052398
|
||||
176.69873 1.0060496
|
||||
177.70152 0.9967013
|
||||
178.7043 0.9878458
|
||||
179.70709 0.9839804
|
||||
180.70987 0.9760148
|
||||
181.71266 0.9612156
|
||||
182.71545 0.95233417
|
||||
183.71823 0.94827366
|
||||
184.72102 0.95032763
|
||||
185.7238 0.9489888
|
||||
186.7266 0.9413412
|
||||
187.72937 0.9321435
|
||||
188.73216 0.9269663
|
||||
189.73494 0.9275942
|
||||
190.73773 0.931649
|
||||
191.74052 0.93175244
|
||||
192.7433 0.9294
|
||||
193.7461 0.9268199
|
||||
194.74887 0.92264336
|
||||
195.75166 0.91768956
|
||||
196.75444 0.91781014
|
||||
197.75723 0.9279098
|
||||
198.76001 0.9326931
|
||||
199.7628 0.9248333
|
||||
200.76558 0.9208289
|
||||
201.76837 0.92364204
|
||||
202.77116 0.9299292
|
||||
203.77394 0.9292018
|
||||
204.77673 0.9185374
|
||||
205.77951 0.91318405
|
||||
206.7823 0.9146962
|
||||
207.78508 0.91144925
|
||||
208.78787 0.90992945
|
||||
209.79065 0.911773
|
||||
210.79344 0.9122371
|
||||
211.79623 0.90611064
|
||||
212.79901 0.90441227
|
||||
213.8018 0.9121109
|
||||
214.80458 0.90272975
|
||||
215.80737 0.89632297
|
||||
216.81015 0.89989316
|
||||
217.81294 0.9051845
|
||||
218.81572 0.9100196
|
||||
219.81851 0.9102259
|
||||
220.8213 0.9135357
|
||||
221.82408 0.91254646
|
||||
222.82687 0.92026895
|
||||
223.82965 0.9256599
|
||||
224.83244 0.93140644
|
||||
225.83522 0.94289523
|
||||
226.83801 0.9277499
|
||||
227.84079 0.9251155
|
||||
228.84358 0.9344981
|
||||
229.84636 0.93383306
|
||||
230.84915 0.9371384
|
||||
231.85194 0.9566001
|
||||
232.85472 0.98191655
|
||||
233.85751 1.0115029
|
||||
234.86029 1.052593
|
||||
235.86308 1.0647767
|
||||
236.86586 1.0809778
|
||||
237.86865 1.1169581
|
||||
238.87143 1.144694
|
||||
239.87422 1.1597354
|
||||
240.87701 1.1733167
|
||||
241.87979 1.1917465
|
||||
242.88258 1.2060626
|
||||
243.88536 1.2150607
|
||||
244.88815 1.224319
|
||||
245.89093 1.2263381
|
||||
246.89372 1.2341791
|
||||
247.8965 1.2424152
|
||||
248.89929 1.253828
|
||||
249.90208 1.259936
|
||||
250.90486 1.2629273
|
||||
251.90765 1.2670362
|
||||
252.91043 1.2750268
|
||||
253.91322 1.2844045
|
||||
254.916 1.2853887
|
||||
255.9188 1.2811004
|
||||
256.92157 1.2833349
|
||||
257.92435 1.2966868
|
||||
258.92715 1.3158177
|
||||
259.92993 1.3382878
|
||||
260.9327 1.3550657
|
||||
261.93552 1.370769
|
||||
262.9383 1.3981235
|
||||
263.94107 1.4086291
|
||||
264.94385 1.4224737
|
||||
265.94666 1.4538087
|
||||
266.94943 1.4778475
|
||||
@@ -0,0 +1,89 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
x_data = np.linspace(0,10,150)
|
||||
y1 = np.sin(3*x_data+(3.14159/2))
|
||||
y2 = 1.5*np.e**(-0.7*x_data)
|
||||
y3 = 1.5*np.e**(-0.7*x_data)*np.sin(3*x_data+(3.14159/2))
|
||||
|
||||
|
||||
################################# BASIC PLOT CODE #################################
|
||||
|
||||
# Basic Styling
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20, # Fonts
|
||||
'axes.titlesize': 30, # |
|
||||
'axes.labelsize': 25, # V
|
||||
'xtick.labelsize': 20,
|
||||
'ytick.labelsize': 20,
|
||||
'legend.fontsize': 20,
|
||||
'figure.titlesize': 30,
|
||||
'figure.figsize': [9,6] # Figure Size
|
||||
})
|
||||
|
||||
# Figure Setup
|
||||
fig, ax = plt.subplots()
|
||||
title = 'Damped Oscillation' # Title
|
||||
xlab = 'Time' # X Label
|
||||
ylab = 'Force' # Y Label
|
||||
ax.set_xlabel(xlab)
|
||||
ax.set_ylabel(ylab)
|
||||
ax.set_title(title, pad=40)
|
||||
#fig.suptitle(title)
|
||||
|
||||
x_min = 0 # Axis Limits and Ticks
|
||||
x_max = 10
|
||||
x_step = 1
|
||||
|
||||
y_min = -1.5
|
||||
y_max = 1.6
|
||||
y_step = 1
|
||||
|
||||
ax.set_xlim(x_min,x_max)
|
||||
ax.set_xticks(np.arange(x_min,x_max,x_step))
|
||||
ax.set_xticks(np.arange(x_min,x_max,0.5), minor=True)
|
||||
|
||||
ax.set_ylim(y_min,y_max)
|
||||
ax.set_yticks(np.arange(y_min,y_max,y_step))
|
||||
ax.set_yticks(np.arange(y_min,y_max,0.5),minor=True)
|
||||
|
||||
#ax.minorticks_on()
|
||||
|
||||
ax.grid(True, which='major',alpha=0.5)
|
||||
ax.grid(True, which='minor',alpha=0.2)
|
||||
|
||||
|
||||
###################### Single Line ######################
|
||||
# x = []
|
||||
# y = []
|
||||
|
||||
# ax.plot(x,y,color='black',linestyle='-',linewidth='1')
|
||||
# # Basic Line Styles: -, --, :, -.
|
||||
# # Basic Colors: red, blue, green, purple, cyan, magenta, black, brown, etc
|
||||
# # Can Specify Hex code for colors
|
||||
|
||||
# plt.show()
|
||||
|
||||
###################### Multi Line ######################
|
||||
x = [x_data,x_data,x_data] # List of Lists
|
||||
y = [y1,y2,y3] # List of Lists
|
||||
|
||||
#### Lists must be equal length ###
|
||||
|
||||
dl = ['Sine Part', 'Exponential Part','Result'] # Data Labels (list)
|
||||
lc = ['#ae5a41', '#559e83','#5a5255'] # Line Color |
|
||||
ls = ['--','--','-'] # Line Style |
|
||||
lw = ['1','1','2'] # Line Width V
|
||||
|
||||
for i in range(len(x)):
|
||||
ax.plot(x[i],y[i],label=dl[i],color=lc[i],linestyle=ls[i],linewidth=lw[i])
|
||||
|
||||
ax.legend(loc='center', bbox_to_anchor=(0.5, 1.04), ncol=len(x), frameon=False, columnspacing=1, handlelength=0.75,
|
||||
handletextpad=0.2)
|
||||
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def get_data(filename):
|
||||
file = open(filename)
|
||||
title = file.readline()
|
||||
lines = file.readlines()
|
||||
x = []
|
||||
y = []
|
||||
for line in lines:
|
||||
line.strip()
|
||||
data = line.split()
|
||||
x.append(float(data[0]))
|
||||
y.append(float(data[1]))
|
||||
return x, y
|
||||
|
||||
x_meas, y_meas = get_data('Plotting\Base\Measured.txt')
|
||||
x_sim, y_sim = get_data("Plotting\Base\Simulated.txt")
|
||||
|
||||
#print(min(x_meas),min(x_sim))
|
||||
|
||||
################################# BASIC PLOT CODE #################################
|
||||
|
||||
# Basic Styling
|
||||
plt.rcParams.update({
|
||||
'font.family': 'Courier New', # monospace font
|
||||
'font.size': 20, # Fonts
|
||||
'axes.titlesize': 30, # |
|
||||
'axes.labelsize': 20, # V
|
||||
'xtick.labelsize': 15,
|
||||
'ytick.labelsize': 15,
|
||||
'legend.fontsize': 20,
|
||||
'figure.titlesize': 20,
|
||||
'figure.figsize': [10,10] # Figure Size
|
||||
})
|
||||
|
||||
# Figure Setup
|
||||
fig, ax = plt.subplots()
|
||||
title = 'PV Diagram' # Title
|
||||
xlab = '% of Volume' # X Label
|
||||
ylab = 'Cyinder Pressure [Bar]' # Y Label
|
||||
ax.set_xlabel(xlab)
|
||||
ax.set_ylabel(ylab, labelpad=0)
|
||||
ax.set_title(title, pad = 0) #pad controls distance to plot
|
||||
ax.spines['top'].set_visible(False) # Controls non axis borders
|
||||
ax.spines['right'].set_visible(False)
|
||||
# ax.set_xscale('log')
|
||||
# ax.set_yscale('log')
|
||||
|
||||
x_min = 0 # Axis Limits and Ticks
|
||||
x_max = 1.1
|
||||
x_step_maj = 1 #steps not division
|
||||
x_step_min = 1
|
||||
|
||||
y_min = 0
|
||||
y_max = 25
|
||||
y_step_maj = 25
|
||||
y_step_min = 1
|
||||
|
||||
ax.set_xlim(x_min,x_max) # X limits
|
||||
ax.set_xticks([0.1047,1]) # X Major Ticks
|
||||
# ax.set_xticks(np.arange(x_min,x_max,x_step_min), minor=True) # X Minor Ticks
|
||||
|
||||
ax.set_ylim(y_min,y_max) # Y limits
|
||||
ax.set_yticks([24.04,24.68]) # Y Major Ticks
|
||||
# ax.set_yticks(np.arange(y_min,y_max,y_step_min),minor=True) # Y Minor Ticks
|
||||
|
||||
|
||||
# ax.grid(True, which='major',alpha=1, lw=1, ls='--', color='black') # Turn On Major Grid
|
||||
# ax.grid(True, which='minor',alpha=0.2) # Turn on Minor Grid
|
||||
# alpha controls transparency
|
||||
|
||||
###################### Single Line ######################
|
||||
# x = []
|
||||
# y = []
|
||||
|
||||
# ax.plot(x,y,color='black',linestyle='-',linewidth='1')
|
||||
# # Basic Line Styles: -, --, :, -.
|
||||
# # Basic Colors: red, blue, green, purple, cyan, magenta, black, brown, etc
|
||||
# # Can Specify Hex code for colors
|
||||
|
||||
# ax.scatter(x,y,color='black',marker='o',size=20)
|
||||
# # Many Markers: circle-'o', square-'s', triangle-'^',star-'*', x-'x'
|
||||
|
||||
# plt.show()
|
||||
|
||||
###################### Multi Line ######################
|
||||
x = [x_meas,x_sim,[1,1],[.107,.107],[0,.125],[0,.125]] # List of Lists
|
||||
y = [y_meas,y_sim,[0,1.1],[0,12.5],[24.04,24.04],[24.68,24.68]] # List of Lists
|
||||
|
||||
#### Lists must be equal length ###
|
||||
|
||||
dl = ['Measured', 'Simulated','','','',''] # Data Labels (list)
|
||||
lc = ['black', 'black','black','black','black','black'] # Line Color |
|
||||
ls = ['-','--','--','--', '--','--'] # Line Style |
|
||||
lw = [1.5,2,1,1,1,1] # Line Width V
|
||||
a = [1,1,1,1,1,1]
|
||||
s = [] # Marker Size, 20 is default
|
||||
m = [] # Marker Type, 'o' is default
|
||||
# Use color-hex.com for color pallets
|
||||
# Common ones: Shades of Teal, Ocean Breezes By,Ppt Cv
|
||||
|
||||
|
||||
|
||||
for i in range(len(x)):
|
||||
ax.plot(x[i],y[i],label=dl[i],color=lc[i],linestyle=ls[i],linewidth=lw[i],alpha=a[i])
|
||||
#ax.scatter(x[i],y[i],label=dl[i],color=lc[i],marker=m[i],size=s[i])
|
||||
|
||||
ax.legend(loc='upper right', bbox_to_anchor=(0.85, 0.85), ncol=1, frameon=False, labelspacing=0.2, columnspacing=0.75,
|
||||
handlelength=1, handletextpad=0.3)
|
||||
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||
# labelspacing is for vertical spacing, column is for horizontal, handel is for line length, textpad is for handl eto text
|
||||
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
1488
syncthing/sync/Coding Projects/Python/Plotting/Base/Simulated.txt
Executable file
1488
syncthing/sync/Coding Projects/Python/Plotting/Base/Simulated.txt
Executable file
File diff suppressed because it is too large
Load Diff
1546
syncthing/sync/Coding Projects/Python/Plotting/Base/Simulated_P.txt
Executable file
1546
syncthing/sync/Coding Projects/Python/Plotting/Base/Simulated_P.txt
Executable file
File diff suppressed because it is too large
Load Diff
1440
syncthing/sync/Coding Projects/Python/Plotting/Base/mass_2bar.txt
Executable file
1440
syncthing/sync/Coding Projects/Python/Plotting/Base/mass_2bar.txt
Executable file
File diff suppressed because it is too large
Load Diff
1440
syncthing/sync/Coding Projects/Python/Plotting/Base/mass_atm.txt
Executable file
1440
syncthing/sync/Coding Projects/Python/Plotting/Base/mass_atm.txt
Executable file
File diff suppressed because it is too large
Load Diff
1981
syncthing/sync/Coding Projects/Python/Plotting/Base/temperature.txt
Executable file
1981
syncthing/sync/Coding Projects/Python/Plotting/Base/temperature.txt
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user