mohrcircleplotter¶
Submodules¶
mohrcircleplotter.plotter module¶
mohrcircleplotter: Mohr circle construction and stress transformation utilities.
Copyright (c) 2026 Earl Magsipoc Licensed under the MIT License. See LICENSE for details.
DISCLAIMER: For educational and research use only. The author accepts no liability for use of this software in engineering design or decision-making. Verify all results independently before use in practice.
- mohrcircleplotter.plotter.principal_stress_circle(p1=None, p2=None, p3=None, ax=None, num_points=100, **kwargs)[source]¶
Create a Mohr circle from principal stresses.
- Parameters:
p1 (float | None) – Maximum principal stress.
p2 (float | None) – Intermediate (or minimum) principal stress.
p3 (float | None) – Minimum principal stress (if 3D).
ax (Axes | None) – Optional Matplotlib Axes to plot on. If None, uses current axes.
num_points (int) – Number of points to use for plotting the circle perimeter.
kwargs (Any) – Additional keyword arguments. Recognized: halfplot (bool): If True, only plot the upper half of the circle. matplotlib.axes.Axes.plot kwargs: Any additional kwargs are forwarded to the ax.plot call for the circle.
- Return type:
- mohrcircleplotter.plotter.oriented_circle(sigma_x, sigma_y, tau_xy, show_plane=True, ax=None, num_points=100, **kwargs)[source]¶
Create a Mohr circle from oriented plane stresses.
- Parameters:
sigma_x (float) – Normal stress in x-direction.
sigma_y (float) – Normal stress in y-direction.
tau_xy (float) – Shear stress on xy-plane.
show_plane (bool) – Whether to plot the plane orientation line.
label – Optional legend label for the circle.
ax (Axes | None) – Optional Matplotlib Axes to plot on. If None, uses current axes.
num_points (int) – Number of points to use for plotting the circle perimeter.
kwargs (Any) – Additional keyword arguments. Recognized: halfplot (bool): If True, only plot the upper half of the circle. matplotlib.axes.Axes.plot kwargs: Any additional kwargs are forwarded to the ax.plot call for the circle.
- Return type:
- mohrcircleplotter.plotter.mc_envelope(c, phi_radians, parameters_label=False, show_tension=False, ax=None)[source]¶
Plot a Mohr-Coulomb failure envelope.
- Parameters:
c (float) – Cohesion intercept.
phi_radians (float) – Friction angle in radians.
parameters_label (bool) – Whether to annotate the envelope parameters on the plot.
ax (Axes | None) – Optional Axes to plot on. If None, uses current axes.
show_tension (bool)
- Return type:
None
- mohrcircleplotter.plotter.estimated_mc_envelope(circles, parameters_label=False, show_tension=False, ax=None, report_params=True, **kwargs)[source]¶
Estimate and plot a linear Mohr-Coulomb envelope from given circles.
- Parameters:
circles (Sequence[Circle]) – Sequence of Circle objects to use for envelope estimation.
parameters_label (bool) – Whether to annotate the envelope parameters on the plot.
ax (Axes | None) – Optional Axes to plot on. If None, uses current axes.
report_params (bool) – Whether to print the estimated parameters to the console.
kwargs (Any) – Additional keyword arguments. Recognized: halfplot (bool): If True, only plot the upper half of the envelope. matplotlib.axes.Axes.plot kwargs: Any additional kwargs are forwarded to the ax.plot call for the envelope lines.
show_tension (bool)
- Return type:
None
- class mohrcircleplotter.plotter.MohrPlot(**kwargs)[source]¶
Bases:
object- Parameters:
kwargs (Any)
- __init__(**kwargs)[source]¶
Create a Mohr circle plotting helper.
Keyword arguments are forwarded to
matplotlib.pyplot.figureafter consuminghalfplotandshow_tension.- Parameters:
show_tension – Whether to include negative normal stresses (tension) in the plot.
halfplot – If True, only plot the upper half of circles and envelopes.
**kwargs (Any) – Figure options and plot behavior flags.
- Return type:
None
- property tension_cutoff: float¶
Return the minimum normal stress shown when tension is enabled.
- Returns:
Minimum normal-stress value across circles/envelopes.
- Return type:
float
- property max_stress: float¶
Return the maximum normal stress represented in the plot.
- Returns:
Largest circle right-most x value.
- Return type:
float
- principal_stress_circle(p1=None, p2=None, p3=None, label=None, num_points=100)[source]¶
Add a circle defined by principal stresses.
- Parameters:
p1 (float | None) – Maximum principal stress.
p3 (float | None) – Minimum principal stress.
p2 (float | None) – Intermediate principal stress (optional).
label (str | None) – Optional legend label.
num_points (int) – Number of perimeter points for plotting.
- Returns:
Index of the newly stored circle.
- Return type:
int
- oriented_circle(sigma_x, sigma_y, tau_xy, label=None, num_points=100)[source]¶
Add a circle from a 2D stress tensor.
- Parameters:
sigma_x (float) – Normal stress in x direction.
sigma_y (float) – Normal stress in y direction.
tau_xy (float) – In-plane shear stress.
label (str | None) – Optional legend label.
num_points (int) – Number of perimeter points for plotting.
- Returns:
Index of the newly stored circle.
- Return type:
int
- oriented_plane(plane_angle, circle_index=0)[source]¶
Plot a plane-orientation line on an existing circle.
- Parameters:
plane_angle (float) – Plane angle in radians.
label – Optional label for the plane.
circle_index (int) – Index of the target stored circle.
- Return type:
None
- estimated_mc_envelope(circles=None, parameters_label=False)[source]¶
Estimate and plot a linear Mohr-Coulomb envelope from circles.
- Parameters:
circles (Sequence[int] | None) – Optional indices of circles to include in the fit.
parameters_label (bool) – Whether to annotate the envelope parameters.
plot_tension_cutoff – Reserved compatibility parameter.
- Return type:
None
mohrcircleplotter.circle module¶
mohrcircleplotter: Mohr circle construction and stress transformation utilities.
Copyright (c) 2026 Earl Magsipoc Licensed under the MIT License. See LICENSE for details.
DISCLAIMER: For educational and research use only. The author accepts no liability for use of this software in engineering design or decision-making. Verify all results independently before use in practice.
- class mohrcircleplotter.circle.Circle(**kwargs)[source]¶
Bases:
object- Parameters:
kwargs (float | None)
- __init__(**kwargs)[source]¶
Initialize a Mohr circle from principal or plane stress values.
Parameters are expected as keyword arguments. Use either principal stresses (
p1,p3and optionallyp2) or oriented plane-stress values (sigma_x,sigma_y,tau_xy).- Parameters:
**kwargs (float | None) – Numeric stress values used to define the circle.
- Return type:
None
- property C: float¶
Return the center of the principal stress circle.
- Returns:
Circle center on the normal-stress axis.
- Return type:
float
- property R: float¶
Return the radius of the principal stress circle.
- Returns:
Circle radius.
- Return type:
float
- property R12: float¶
Return the radius for the circle between
p1andp2.- Returns:
Radius of the
p1-p2circle.- Return type:
float
- property R23: float¶
Return the radius for the circle between
p2andp3.- Returns:
Radius of the
p2-p3circle.- Return type:
float
- get_circle_points(num_points=100, half_circle=False, pstress=12)[source]¶
Generate x/y coordinates on the Mohr circle perimeter.
- Parameters:
num_points (int) – Number of sample points along the perimeter.
half_circle (bool) – If
True, generate only the upper half circle.pstress (int) – Reserved argument kept for backward compatibility.
- Returns:
Tuple of x and y arrays for plotting.
- Return type:
tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]
Module contents¶
mohrcircleplotter: Mohr circle construction and stress transformation utilities.
Copyright (c) 2026 Earl Magsipoc Licensed under the MIT License. See LICENSE for details.
DISCLAIMER: For educational and research use only. The author accepts no liability for use of this software in engineering design or decision-making. Verify all results independently before use in practice.