import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
eng_const_names = [
'e1', 'e2', 'e3', 'nu12', 'nu13', 'nu23', 'g12', 'g13', 'g23'
]
eng_const_labels = [
r'$E_1$', r'$E_2$', r'$E_3$',
r'$\nu_{12}$', r'$\nu_{13}$', r'$\nu_{23}$',
r'$G_{12}$', r'$G_{13}$', r'$G_{23}$'
]
df = pd.read_csv('results/t18_results.csv')
# Create 3x3 subplot grid
fig = make_subplots(
rows=3, cols=3,
subplot_titles=eng_const_labels,
shared_xaxes=True,
shared_yaxes='rows',
vertical_spacing=0.1,
horizontal_spacing=0.05
)
# Plot each engineering constant
for i, const_name in enumerate(eng_const_names):
row = i // 3 + 1
col = i % 3 + 1
fig.add_trace(
go.Scatter(
x=df['radius'],
y=df[const_name],
mode='lines+markers',
line=dict(width=2, color='black'),
name=eng_const_labels[i],
showlegend=False
),
row=row, col=col
)
# Update layout
fig.update_layout(
title="Engineering Constants vs Radius",
template='plotly_white',
height=600,
width=600,
)
# Update axes labels
fig.update_xaxes(title_text="Radius", row=3, col=1)
fig.update_xaxes(title_text="Radius", row=3, col=2)
fig.update_xaxes(title_text="Radius", row=3, col=3)
fig.update_yaxes(title_text="Young's Modulus (Pa)", row=1, col=1)
fig.update_yaxes(title_text="Poisson's Ratio", row=2, col=1)
fig.update_yaxes(title_text="Shear Modulus (Pa)", row=3, col=1)
fig.show()Loading...
Engineering constants vs fiber radius for the T18 example.