From a77872c24d301e3d839e0c7b66a347170fb1e910 Mon Sep 17 00:00:00 2001 From: Anson Date: Mon, 20 Jan 2020 11:27:17 -0700 Subject: [PATCH] code cleanup --- PlaneStress.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PlaneStress.py b/PlaneStress.py index 19c1fc6..870c7c2 100644 --- a/PlaneStress.py +++ b/PlaneStress.py @@ -17,8 +17,8 @@ class PlaneStress: self.sigma_2 = ((self.sigma_x + self.sigma_y) / 2) - self.tau_max def plane(self): + # Settings to make the plot look correct. plot = figure(x_range=(-5, 5), y_range=(-5, 5)) - plot.axis.major_label_text_font_size = "0pt" plot.axis.major_tick_line_color = None plot.axis[0].ticker.num_minor_ticks = 0 @@ -26,6 +26,7 @@ class PlaneStress: plot.grid.visible = False plot.axis.visible = False + # Draw the rectangle plot.rect(0, 0, 4, 4, fill_alpha=0, line_color="black", line_width=3) # sigma_x @@ -33,7 +34,7 @@ class PlaneStress: plot.add_layout(Arrow(x_start=-2, y_start=0, x_end=-4.5, y_end=0)) plot.add_layout( LatexLabel( - x=3.5, y=0.75, text=f"\\sigma_{{x}} = {self.sigma_x}", render_mode="css" + x=3.0, y=0.7, text=f"\\sigma_{{x}} = {self.sigma_x}", render_mode="css" ) ) @@ -49,6 +50,8 @@ class PlaneStress: # tau_xy plot.add_layout(Arrow(x_start=2.5, y_start=-2, x_end=2.5, y_end=2.2)) plot.add_layout(Arrow(y_start=2.5, x_start=-2, y_end=2.5, x_end=2.2)) + plot.add_layout(Arrow(x_start=-2.5, y_start=2, x_end=-2.5, y_end=-2.2)) + plot.add_layout(Arrow(y_start=-2.5, x_start=2, y_end=-2.5, x_end=-2.2)) plot.add_layout( LatexLabel( x=2.5, y=2.6, text=f"\\tau_{{xy}} = {self.tau_xy}", render_mode="css" @@ -83,7 +86,3 @@ class PlaneStress: show(plot) - -x = PlaneStress(80, -40, 25) - -x.plane()