modusa 0.3.74__py3-none-any.whl → 0.3.75__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- modusa/tools/plotter.py +42 -28
- {modusa-0.3.74.dist-info → modusa-0.3.75.dist-info}/METADATA +1 -1
- {modusa-0.3.74.dist-info → modusa-0.3.75.dist-info}/RECORD +6 -6
- {modusa-0.3.74.dist-info → modusa-0.3.75.dist-info}/WHEEL +0 -0
- {modusa-0.3.74.dist-info → modusa-0.3.75.dist-info}/entry_points.txt +0 -0
- {modusa-0.3.74.dist-info → modusa-0.3.75.dist-info}/licenses/LICENSE.md +0 -0
modusa/tools/plotter.py
CHANGED
|
@@ -541,24 +541,26 @@ class Fig:
|
|
|
541
541
|
from matplotlib.patches import Rectangle
|
|
542
542
|
import matplotlib.pyplot as plt
|
|
543
543
|
|
|
544
|
-
def
|
|
544
|
+
def add_arrows(self, xys, labels, text_offset=(0, 0), c="r", fontsize=12, ax=None):
|
|
545
545
|
"""
|
|
546
|
-
Add
|
|
546
|
+
Add multiple arrows pointing to specific points with boxed labels at the tails.
|
|
547
547
|
|
|
548
548
|
Parameters
|
|
549
549
|
----------
|
|
550
|
-
|
|
551
|
-
-
|
|
552
|
-
|
|
553
|
-
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
-
|
|
561
|
-
|
|
550
|
+
xys : list[tuple[float, float]]
|
|
551
|
+
- List of target points (x, y) for the arrow heads.
|
|
552
|
+
labels : list[str] | str
|
|
553
|
+
- List of text labels at the arrow tails.
|
|
554
|
+
- If str, the same label is used for all points.
|
|
555
|
+
text_offset : tuple[float, float] | list[tuple[float, float]]
|
|
556
|
+
- Offset(s) (dx, dy) for label positions from arrow tails.
|
|
557
|
+
- If single tuple, same offset is applied to all.
|
|
558
|
+
c : str | list[str]
|
|
559
|
+
- Color(s) for arrow and text.
|
|
560
|
+
- If str, same color is applied to all.
|
|
561
|
+
fontsize : int | list[int]
|
|
562
|
+
- Font size(s) of the label text.
|
|
563
|
+
- If int, same size is applied to all.
|
|
562
564
|
ax : int | None
|
|
563
565
|
- Which specific axis to plot (1, 2, 3, ...).
|
|
564
566
|
- If None, uses the current row.
|
|
@@ -569,21 +571,33 @@ class Fig:
|
|
|
569
571
|
"""
|
|
570
572
|
curr_row = self._get_prev_row() if ax is None else self._axs[ax]
|
|
571
573
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
+
# Normalize single values into lists
|
|
575
|
+
n = len(xys)
|
|
576
|
+
if isinstance(labels, str):
|
|
577
|
+
labels = [labels] * n
|
|
578
|
+
if isinstance(text_offset, tuple):
|
|
579
|
+
text_offset = [text_offset] * n
|
|
580
|
+
if isinstance(c, str):
|
|
581
|
+
c = [c] * n
|
|
582
|
+
if isinstance(fontsize, int):
|
|
583
|
+
fontsize = [fontsize] * n
|
|
574
584
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
585
|
+
for (xy, label, offset, color, fs) in zip(xys, labels, text_offset, c, fontsize):
|
|
586
|
+
arrowprops = dict(arrowstyle="->", color=color, lw=2)
|
|
587
|
+
bbox = dict(boxstyle="round,pad=0.3", fc="white", ec=color, lw=1.2)
|
|
588
|
+
|
|
589
|
+
text_x, text_y = xy[0] + offset[0], xy[1] + offset[1]
|
|
590
|
+
|
|
591
|
+
curr_row[0].annotate(
|
|
592
|
+
label,
|
|
593
|
+
xy=xy, xycoords="data",
|
|
594
|
+
xytext=(text_x, text_y), textcoords="data",
|
|
595
|
+
arrowprops=arrowprops,
|
|
596
|
+
fontsize=fs,
|
|
597
|
+
color=color,
|
|
598
|
+
ha="center", va="center",
|
|
599
|
+
bbox=bbox
|
|
600
|
+
)
|
|
587
601
|
|
|
588
602
|
def add_legend(self, ypos=1.0):
|
|
589
603
|
"""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
modusa-0.3.
|
|
2
|
-
modusa-0.3.
|
|
3
|
-
modusa-0.3.
|
|
4
|
-
modusa-0.3.
|
|
1
|
+
modusa-0.3.75.dist-info/METADATA,sha256=Z_3ZBuYSz8nhxDJmE1LKgOqTjgmWMlXvqkwmabr4kQM,1436
|
|
2
|
+
modusa-0.3.75.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
modusa-0.3.75.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
|
|
4
|
+
modusa-0.3.75.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
|
|
5
5
|
modusa/.DS_Store,sha256=_gm6qJREwfMi8dE7n5S89_RG46u5t3xHyD-smNhtNoM,6148
|
|
6
6
|
modusa/__init__.py,sha256=RMIKAZZ27w1oh2UFMJvZQtQ-SluIQsac_3mSK_LaM30,277
|
|
7
7
|
modusa/config.py,sha256=bTqK4t00FZqERVITrxW_q284aDDJAa9aMSfFknfR-oU,280
|
|
@@ -50,7 +50,7 @@ modusa/tools/audio_player.py,sha256=GP04TWW4jBwQBjANkfR_cJtEy7cIhvbu8RTwnf9hD6E,
|
|
|
50
50
|
modusa/tools/audio_recorder.py,sha256=d2fVt0Sd2tlBdb2WlUs60K4N23zuxM3KUpQqX0ifPi8,2769
|
|
51
51
|
modusa/tools/base.py,sha256=C0ESJ0mIfjjRlAkRbSetNtMoOfS6IrHBjexRp3l_Mh4,1293
|
|
52
52
|
modusa/tools/math_ops.py,sha256=ZZ7U4DgqT7cOeE7_Lzi_Qq-48WYfwR9_osbZwTmE9eg,8690
|
|
53
|
-
modusa/tools/plotter.py,sha256=
|
|
53
|
+
modusa/tools/plotter.py,sha256=00sXkQyH_LNroxG_C3LAkvpRQsC3Yk-c8j99g36JzJ8,23583
|
|
54
54
|
modusa/tools/youtube_downloader.py,sha256=hB_X8-7nOHXOlxg6vv3wyhBLoAsWyomrULP6_uCQL7s,1698
|
|
55
55
|
modusa/utils/.DS_Store,sha256=nLXMwF7QJNuglLI_Gk74F7vl5Dyus2Wd74Mgowijmdo,6148
|
|
56
56
|
modusa/utils/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
|
|
@@ -59,4 +59,4 @@ modusa/utils/excp.py,sha256=L9vhaGjKpv9viJYdmC9n5ndmk2GVbUBuFyZyhAQZmWY,906
|
|
|
59
59
|
modusa/utils/logger.py,sha256=K0rsnObeNKCxlNeSnVnJeRhgfmob6riB2uyU7h3dDmA,571
|
|
60
60
|
modusa/utils/np_func_cat.py,sha256=TyIFgRc6bARRMDnZxlVURO5Z0I-GWhxRONYyIv-Vwxs,1007
|
|
61
61
|
modusa/utils/plot.py,sha256=s_vNdxvKfwxEngvJPgrF1PcmxZNnNaaXPViHWjyjJ-c,5335
|
|
62
|
-
modusa-0.3.
|
|
62
|
+
modusa-0.3.75.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|