Skip to content

Commit 0b40a85

Browse files
authored
adjust text settings (#67)
1 parent 4f0381b commit 0b40a85

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

pybbda/graphics/graphical_standings.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,38 @@
2727

2828
Point = namedtuple("Point", ("x", "y"))
2929

30-
DEFAULT_EXPAND = 1.5
31-
FORCE_TEXT = 1.0
30+
ForceMultiplier = namedtuple("ForceMultiplier", ("x", "y"))
31+
ExpandMultiplier = namedtuple("ExpandMultiplier", ("x", "y"))
3232

33-
force_pts = 1.0
34-
force_obj = 1.0
33+
# defaults: (1.05, 1.20)
34+
k = 0.2
35+
EXPAND_TEXT = ExpandMultiplier(1.05*k, 1.2*k)
36+
EXPAND_POINTS = ExpandMultiplier(1.05, 1.2)
37+
EXPAND_OBJECTS = ExpandMultiplier(1.05, 1.2)
38+
39+
40+
# defaults are
41+
# text: (0.1, 0.25)
42+
# points: (0.2, 0.5)
43+
# objects: (0.1, 0.25)
44+
# see https://adjusttext.readthedocs.io/en/latest/
45+
FORCE_TEXT = ForceMultiplier(0.1, 0.25)
46+
FORCE_POINTS = ForceMultiplier(0.2, 0.5)
47+
FORCE_OBJECTS = ForceMultiplier(0.1, 0.25)
3548

3649

3750
adjust_text = {
38-
"expand_points": (DEFAULT_EXPAND, DEFAULT_EXPAND),
39-
"expand_text": (DEFAULT_EXPAND, DEFAULT_EXPAND),
40-
"expand_objects": (DEFAULT_EXPAND, DEFAULT_EXPAND),
41-
"force_text": (FORCE_TEXT, FORCE_TEXT),
42-
"force_points": (force_pts, force_pts),
43-
"force_objects": (force_obj, force_obj),
51+
"expand_points": (EXPAND_POINTS.x, EXPAND_POINTS.y),
52+
"expand_text": (EXPAND_TEXT.x, EXPAND_TEXT.y),
53+
"expand_objects": (EXPAND_OBJECTS.x, EXPAND_OBJECTS.y),
54+
"force_text": (FORCE_TEXT.x, FORCE_TEXT.y),
55+
"force_points": (FORCE_POINTS.x, FORCE_POINTS.y),
56+
"force_objects": (FORCE_OBJECTS.x, FORCE_OBJECTS.y),
4457
"lim": 10000,
4558
"save_steps": False,
46-
# "avoid_self": False,
59+
"avoid_text": True,
60+
"avoid_points": False,
61+
"avoid_self": False,
4762
# "arrowprops": {"arrowstyle": "-", "color": "k", "lw": 0.25},
4863
}
4964

0 commit comments

Comments
 (0)