Skip to content
Snippets Groups Projects
Commit 589a2c80 authored by Klaus Böhnlein's avatar Klaus Böhnlein
Browse files

Update & Add Prestrain Plot Methods in python

parent 74577270
No related branches found
No related tags found
No related merge requests found
...@@ -165,7 +165,7 @@ lambda1 = 0.0 ...@@ -165,7 +165,7 @@ lambda1 = 0.0
gamma = 1.0/4.0 gamma = 1.0/4.0
gamma = 'infinity' #Elliptic Setting gamma = 'infinity' #Elliptic Setting
gamma = '0' #Hyperbolic Setting # gamma = '0' #Hyperbolic Setting
# gamma = 0.5 # gamma = 0.5
......
...@@ -14,6 +14,11 @@ import matplotlib.ticker as ticker ...@@ -14,6 +14,11 @@ import matplotlib.ticker as ticker
# from subprocess import Popen, PIPE # from subprocess import Popen, PIPE
#import sys #import sys
import matplotlib.ticker as tickers
import matplotlib as mpl
from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator
import pandas as pd
###################### makePlot.py ######################### ###################### makePlot.py #########################
# Generalized Plot-Script giving the option to define # Generalized Plot-Script giving the option to define
# quantity of interest and the parameter it depends on # quantity of interest and the parameter it depends on
...@@ -165,7 +170,7 @@ xmax = 0.4 ...@@ -165,7 +170,7 @@ xmax = 0.4
numPoints = 100 numPoints = 200
X_Values = np.linspace(xmin, xmax, num=numPoints) X_Values = np.linspace(xmin, xmax, num=numPoints)
print(X_Values) print(X_Values)
...@@ -297,77 +302,90 @@ print('y_rest:', y_rest) ...@@ -297,77 +302,90 @@ print('y_rest:', y_rest)
print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) )
# ---------------- Create Plot ------------------- # --- Convert to numpy array
plt.figure() Y_Values = np.array(Y_Values)
X_Values = np.array(X_Values)
f,ax=plt.subplots(1)
# plt.title(r''+ yName + '-Plot')
# plt.plot(X_Values, Y_Values,linewidth=2, '.k')
# plt.plot(X_Values, Y_Values,'.k',markersize=1)
# plt.plot(X_Values, Y_Values,'.',markersize=0.8)
# plt.plot(X_Values, Y_Values)
# ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]])
# ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b')
# ax.plot(x_rest, y_rest, 'b')
# ax.plot(X_Values, Y_Values)
# ax.scatter(X_Values, Y_Values)
# plt.plot(x_plotValues, y_plotValues,'.')
# plt.scatter(X_Values, Y_Values, alpha=0.3)
# plt.scatter(X_Values, Y_Values)
# plt.plot(X_Values, Y_Values,'.')
# plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]])
# plt.axis([0, 6, 0, 20])
ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]] ,'b')
ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'b')
plt.xlabel(xName) # ---------------- Create Plot -------------------
mpl.rcParams['text.usetex'] = True
mpl.rcParams["font.family"] = "serif"
mpl.rcParams["font.size"] = "9"
# width as measured in inkscape
width = 6.28 *0.5
height = width / 1.618
fig = plt.figure()
ax = plt.axes((0.15,0.18,0.8,0.8))
ax.tick_params(axis='x',which='major', direction='out',pad=3)
ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3)
ax.xaxis.set_major_locator(MultipleLocator(0.05))
ax.xaxis.set_minor_locator(MultipleLocator(0.025))
ax.grid(True,which='major',axis='both',alpha=0.3)
# plt.figure()
# f,ax=plt.subplots(1)
ax.set_xlabel(r"volume fraction $\theta$")
ax.set_ylabel(r"curvature $\kappa$")
# plt.xlabel(xName)
# plt.ylabel(yName) # plt.ylabel(yName)
# plt.ylabel('$\kappa$')
plt.ylabel('$\kappa$') # ax.grid(True)
# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) # Add transition Points
# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) if gamma == '0':
transition_point1 = 0.13663316582914573
transition_point2 = 0.20899497487437185
plt.axvline(transition_point1,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1)
plt.axvline(transition_point2,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1)
ax.grid(True)
ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue')
# # if angle PLOT : ax.plot(X_Values[np.where(np.logical_and(X_Values>jump_xValues[0], X_Values<jump_xValues[1])) ], Y_Values[np.where(np.logical_and(X_Values>jump_xValues[0] ,X_Values<jump_xValues[1] ))] ,'royalblue')
# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) ax.plot(X_Values[X_Values>jump_xValues[1]], Y_Values[X_Values>jump_xValues[1]], 'royalblue')
# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) # ax.plot(x_plotValues,y_plotValues, 'royalblue')
# ax.scatter([transition_point1, transition_point2],[jump_yValues[0], jump_yValues[1]],s=6, marker='o', cmap=None, norm=None, facecolor = 'black',
# ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3)
#
# # Plot every other line.. not the jumps... ax.text(transition_point1-0.02 , jump_yValues[0]-0.02, r"$4$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)
# tmp = 1 )
# for idx, x in enumerate(x_plotValues):
# if idx > 0 and tmp == 1: ax.text(transition_point2+0.012 , jump_yValues[1]+0.02, r"$5$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)
# # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) )
# ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ,'b')
# tmp = 0 if gamma == 'infinity':
# else: transition_point1 = 0.13663316582914573
# tmp = 1 transition_point2 = 0.1929145728643216
transition_point3 = 0.24115577889447234
# plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) plt.axvline(transition_point1,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1)
# plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) plt.axvline(transition_point2,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1)
# plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) plt.axvline(transition_point3,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1)
# plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue')
ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]], 'royalblue')
for x in jump_xValues: idx1 = find_nearestIdx(X_Values, transition_point1)
plt.axvline(x,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') idx2 = find_nearestIdx(X_Values, transition_point2)
print('idx1', idx1)
# plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') print('idx2', idx2)
Y_TP1 = Y_Values[idx1]
Y_TP2 = Y_Values[idx2]
print('Y_TP1', Y_TP1)
print('Y_TP2', Y_TP2)
ax.scatter([transition_point1, transition_point2],[Y_TP1, Y_TP2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black',
edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3)
ax.text(transition_point1-0.02 , Y_TP1-0.02, r"$6$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)
)
ax.text(transition_point2+0.015 , Y_TP2+0.020, r"$7$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5))
# for x in jump_xValues:
# plt.axvline(x,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed')
fig.set_size_inches(width, height)
fig.savefig('Plot-Curvature-Theta.pdf')
# plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$')
# plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$')
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment