Example using matplotlib with pyPLY


In [1]:
import pyPLY

AS4_3501_6 = pyPLY.CompositeMaterial()
AS4_3501_6.define("AS4_3501_6", "imperial", 20010000.0, 1301000.0, 1001000.0, 0.3, 0.005)

layer1 = pyPLY.Lamina()
layer1.define("Layer_1", 1, 0)
resExx = []
resEyy = []
resGxy = []
resniuxy = []
resniuyx = []
res_eta_xy_xx = []
res_eta_xy_yy = []
xaxis = []

for i in range(0, 91, 2):
    layer1.change_Angle_Lamina(i)
    layer1.update()
    resExx.append(layer1.Exx)
    resEyy.append(layer1.Eyy)
    resGxy.append(layer1.Gxy)
    resniuxy.append(layer1.niuxy)
    resniuyx.append(layer1.niuyx)
    res_eta_xy_xx.append(layer1.eta_xy_xx)
    res_eta_xy_yy.append(layer1.eta_xy_yy)
    xaxis.append(i)

import matplotlib.pyplot as plt
plt.suptitle('AS4_3501_6', fontsize=16)
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.5, hspace=0.5)

plt.subplot(2,2,1)
plt.xlabel("Fiber angle (degree)", fontsize=10)
plt.ylabel("Modulus (lb/sqin)", fontsize=10)
plt.title("Effective Young's moduli Exx & Eyy", fontsize=10)
plt.grid(True)
plt.plot(xaxis, resExx, label='Exx', color='red')
plt.plot(xaxis, resEyy, label='Eyy', color='blue')
plt.legend(('Exx', 'Eyy'), loc='upper center')
leg = plt.gca().get_legend()
ltext  = leg.get_texts()
plt.setp(ltext, fontsize='small')
ax = plt.gca()
for tick in ax.xaxis.get_major_ticks():
    tick.label1.set_fontsize(10)
for tick in ax.yaxis.get_major_ticks():
    tick.label1.set_fontsize(10)

plt.subplot(2,2,2)
plt.xlabel("Fiber angle (degree)", fontsize=10)
plt.ylabel("Shear Modulus (lb/sqin)", fontsize=10)
plt.title("Effective shear modulus Gxy", fontsize=10)
plt.grid(True)
plt.plot(xaxis, resGxy, label="Gxy", color='red')
plt.legend(('Gxy'), loc='lower center')
leg = plt.gca().get_legend()
ltext  = leg.get_texts()
plt.setp(ltext, fontsize='small')
ax = plt.gca()
for tick in ax.xaxis.get_major_ticks():
    tick.label1.set_fontsize(10)
for tick in ax.yaxis.get_major_ticks():
    tick.label1.set_fontsize(10)

plt.subplot(2,2,3)
plt.xlabel("Fiber angle (degree)", fontsize=10)
plt.ylabel("Poisson Ratio", fontsize=10)
plt.title(r'Effective Poisson ratios $\nu_{xy}$ & $\nu_{yx}$', fontsize=10)
plt.grid(True)
plt.plot(xaxis, resniuxy, label='niuxy', color='red')
plt.plot(xaxis, resniuyx, label='niuyx', color='blue')
plt.legend((r'$\nu_{xy}$', r'$\nu_{yx}$'), loc='lower center')
leg = plt.gca().get_legend()
ltext  = leg.get_texts()
plt.setp(ltext, fontsize='small')
ax = plt.gca()
for tick in ax.xaxis.get_major_ticks():
    tick.label1.set_fontsize(10)
for tick in ax.yaxis.get_major_ticks():
    tick.label1.set_fontsize(10)

plt.subplot(2,2,4)
plt.xlabel("Fiber angle (degree)", fontsize=10)
plt.ylabel("Coeff. mutual infl. 1st kind", fontsize=10)
plt.title(r'Coeff. mutual infl. 1st kind $\eta_{xy,xx}$ & $\eta_{xy,yy}$', fontsize=10)
plt.grid(True)
plt.plot(xaxis, res_eta_xy_xx, label='eta_xy_xx', color='red')
plt.plot(xaxis, res_eta_xy_yy, label='eta_xy_yy', color='blue')
plt.legend((r'$\eta_{xy,xx}$', r'$\eta_{xy,yy}$'), loc='upper center')
leg = plt.gca().get_legend()
ltext  = leg.get_texts()
plt.setp(ltext, fontsize='small')
ax = plt.gca()
for tick in ax.xaxis.get_major_ticks():
    tick.label1.set_fontsize(10)
for tick in ax.yaxis.get_major_ticks():
    tick.label1.set_fontsize(10)

plt.show()



In [1]: