From 89729dc16db02d4ec275783113653a484b22bb77 Mon Sep 17 00:00:00 2001
From: hbui <hong-phuc.bui@htwsaar.de>
Date: Fri, 26 Jul 2024 02:14:14 +0200
Subject: [PATCH] set function plot thiner
---
num-int/src/numint/guimain.py | 9 +++++----
num-int/src/numint/riemann_sum.py | 3 +--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/num-int/src/numint/guimain.py b/num-int/src/numint/guimain.py
index 076d851..65f3b92 100644
--- a/num-int/src/numint/guimain.py
+++ b/num-int/src/numint/guimain.py
@@ -37,6 +37,7 @@
self.ui.plotBtn.clicked.connect(self._update_plot)
self.ui.breakMethod.buttonClicked.connect(self._activate_break_rule)
self.ui.numberOfSectionsMethod.click()
+ self.ui.plotBtn.click()
def _update_plot(self):
fn_expr = self.ui.function.text()
@@ -54,26 +55,26 @@
self.ui.espilon.setText(f"{eps}")
print(f"plot f(x) = {fn_expr}, {a}, {b}, epsilon = {eps}")
(self.x, self.y, self.left, self.right, self.num_of_iterations, *_) = numint_epsilon(f, a, b, eps)
- self._update_plot_eps()
+ self._plot_canvas()
elif method_id == self.ui.breakMethod.id(self.ui.numberOfSectionsMethod):
section = self.ui.section.text()
sec = int(abs(parse_value(section)))
self.ui.section.setText(f"{sec}")
print(f"plot f(x) = {fn_expr}, {a}, {b}, section = {sec}")
(self.x, self.y, self.left, self.right, self.num_of_iterations, *_) = numint_section(f, a, b, sec)
- self._update_plot_eps()
+ self._plot_canvas()
except Exception as ex:
print(ex)
pass
- def _update_plot_eps(self):
+ def _plot_canvas(self):
self.canvas.axes.cla() # Clear the canvas.
# self.canvas.axes.stairs(self.y[1:], self.x, baseline=0, fill=True, alpha=0.5, label=self.fn_expr)
# self.canvas.axes.stairs(self.y[0:-1], self.x, baseline=0, fill=True, alpha=0.5, label=self.fn_expr)
self.canvas.axes.step(self.x, self.y, color="blue", where="pre", label="right")
self.canvas.axes.step(self.x, self.y, color="orange", where="post", label="left")
- self.canvas.axes.plot(self.x, self.y, color="black", label=self.fn_expr)
+ self.canvas.axes.plot(self.x, self.y, color="black", label=self.fn_expr, linewidth=0.75)
self.canvas.draw()
self.ui.leftSum.setText(f"{self.left}")
diff --git a/num-int/src/numint/riemann_sum.py b/num-int/src/numint/riemann_sum.py
index f0b997d..c2a4117 100644
--- a/num-int/src/numint/riemann_sum.py
+++ b/num-int/src/numint/riemann_sum.py
@@ -1,8 +1,7 @@
from typing import Callable
-def split(iteration=8):
- (a, b) = (0, 8)
+def split(a:float=0, b: float=8, iteration=8):
x = [a, b]
parts = 1
dx = (b - a)
--
Gitblit v1.10.0