master > master: src - clean up
- enums für Alphabete - button layout - refresh Knopf - aspect ratio
This commit is contained in:
@@ -28,7 +28,7 @@ __all__ = [
|
||||
T1 = TypeVar('T1');
|
||||
T2 = TypeVar('T2');
|
||||
|
||||
SCALE = (1., 4.);
|
||||
SCALE = (1., 1.5);
|
||||
OFFSET = (3., 0.);
|
||||
HMARGIN = 0.1;
|
||||
VMARGIN = 0.2;
|
||||
@@ -119,15 +119,15 @@ class Functions:
|
||||
for k, f in enumerate(self.fcts):
|
||||
if k == 0:
|
||||
comp_range = f.domain;
|
||||
p_domain = random_points(nr_points=len(f.domain), scale=SCALE, centre=origin + k*offset);
|
||||
p_domain = random_points(nr_points=len(f.domain), scale=SCALE, centre=origin + k*offset, tol=0.5);
|
||||
else:
|
||||
p_domain = p_codomain;
|
||||
p_codomain = random_points(nr_points=len(f.codomain), scale=SCALE, centre=origin + (k+1)*offset);
|
||||
p_codomain = random_points(nr_points=len(f.codomain), scale=SCALE, centre=origin + (k+1)*offset, tol=0.5);
|
||||
# range of composition so far:
|
||||
comp_range_next = [y for x, y in f.fct if x in comp_range];
|
||||
|
||||
if k == 0:
|
||||
axs.scatter(p_domain[:, 0], p_domain[:, 1], label='', color='black', marker='o');
|
||||
axs.scatter(p_domain[:, 0], p_domain[:, 1], label='', color='blue', marker='o');
|
||||
if show_labels:
|
||||
for i, p in enumerate(p_domain):
|
||||
x_name = f.domain[i];
|
||||
@@ -136,7 +136,7 @@ class Functions:
|
||||
for j, p in enumerate(p_codomain):
|
||||
y = f.codomain[j];
|
||||
marker = 'o' if (y in comp_range_next) else '.';
|
||||
axs.scatter([p[0]], [p[1]], label='', color='black', marker=marker);
|
||||
axs.scatter([p[0]], [p[1]], label='', color='blue', marker=marker);
|
||||
y_name = f.codomain[j];
|
||||
if show_labels:
|
||||
axs.annotate(text=f'{y_name}', xy=p, textcoords='offset points', xytext=ANNOTATE_OFFSET, ha='center', size=FONTSIZE_PTS);
|
||||
@@ -146,7 +146,7 @@ class Functions:
|
||||
q = p_codomain[j];
|
||||
x = f.domain[i];
|
||||
if k == 0 or (x in comp_range):
|
||||
axs.plot([p[0], q[0]], [p[1], q[1]], label='', color='black', linewidth=1);
|
||||
axs.plot([p[0], q[0]], [p[1], q[1]], label='', color='blue', linewidth=1);
|
||||
else:
|
||||
axs.plot([p[0], q[0]], [p[1], q[1]], label='', color='red', linestyle='--', linewidth=1);
|
||||
|
||||
@@ -165,6 +165,7 @@ class Functions:
|
||||
|
||||
# update range of composition:
|
||||
comp_range = comp_range_next;
|
||||
axs.set_aspect('equal')
|
||||
return fig, axs;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -188,7 +189,7 @@ def random_points(
|
||||
scale: tuple[float, float] = (1., 1.),
|
||||
centre: tuple[float, float] = (0., 0.),
|
||||
force: bool = False,
|
||||
tol: float = 0.2,
|
||||
tol: float = 0.1,
|
||||
) -> NDArray[Shape['*, 2'], Float]:
|
||||
theta = np.linspace(start=0, stop=2*np.pi, num=nr_points, endpoint=False);
|
||||
r_min = 0.25;
|
||||
|
||||
Reference in New Issue
Block a user