modusa 0.3.96__py3-none-any.whl → 0.3.98__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/__init__.py +1 -1
- modusa/tools/plotter.py +22 -18
- {modusa-0.3.96.dist-info → modusa-0.3.98.dist-info}/METADATA +1 -1
- {modusa-0.3.96.dist-info → modusa-0.3.98.dist-info}/RECORD +7 -7
- {modusa-0.3.96.dist-info → modusa-0.3.98.dist-info}/WHEEL +0 -0
- {modusa-0.3.96.dist-info → modusa-0.3.98.dist-info}/entry_points.txt +0 -0
- {modusa-0.3.96.dist-info → modusa-0.3.98.dist-info}/licenses/LICENSE.md +0 -0
modusa/__init__.py
CHANGED
modusa/tools/plotter.py
CHANGED
|
@@ -744,6 +744,9 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
744
744
|
Axes to plot on.
|
|
745
745
|
"""
|
|
746
746
|
|
|
747
|
+
plt.style.use("default") # Not supporting dark mode
|
|
748
|
+
plt.rcParams['font.family'] = "DejaVu Sans" # Devnagari not needed for this.
|
|
749
|
+
|
|
747
750
|
created_fig = False
|
|
748
751
|
if ax is None:
|
|
749
752
|
fig, ax = plt.subplots(figsize=(8, len(args) * 1.5))
|
|
@@ -765,7 +768,7 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
765
768
|
parts = ax.violinplot(args, vert=False, showmeans=False, showmedians=False, widths=widths, bw_method=bw_method)
|
|
766
769
|
|
|
767
770
|
# Remove the default bar lines from violin plot
|
|
768
|
-
for key in [
|
|
771
|
+
for key in ["cbars", "cmins", "cmaxes", "cmedians"]:
|
|
769
772
|
if key in parts:
|
|
770
773
|
parts[key].set_visible(False)
|
|
771
774
|
|
|
@@ -774,7 +777,7 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
774
777
|
verts = pc.get_paths()[0].vertices
|
|
775
778
|
y_center = i + 1 # Center y-position for this violin
|
|
776
779
|
|
|
777
|
-
if side ==
|
|
780
|
+
if side == "upper":
|
|
778
781
|
verts[:, 1] = np.maximum(verts[:, 1], y_center)
|
|
779
782
|
else: # 'lower'
|
|
780
783
|
verts[:, 1] = np.minimum(verts[:, 1], y_center)
|
|
@@ -797,6 +800,7 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
797
800
|
x = np.array(x)
|
|
798
801
|
median_val = np.median(x)
|
|
799
802
|
mean_val = np.mean(x)
|
|
803
|
+
std_val = np.std(x)
|
|
800
804
|
|
|
801
805
|
# Get the violin curve vertices
|
|
802
806
|
verts = pc.get_paths()[0].vertices
|
|
@@ -804,37 +808,37 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
804
808
|
# Find y-position on violin curve for median
|
|
805
809
|
median_mask = np.abs(verts[:, 0] - median_val) < (np.ptp(x) * 0.01)
|
|
806
810
|
if median_mask.any():
|
|
807
|
-
median_y = np.max(verts[median_mask, 1]) if side ==
|
|
811
|
+
median_y = np.max(verts[median_mask, 1]) if side == "upper" else np.min(verts[median_mask, 1])
|
|
808
812
|
else:
|
|
809
|
-
median_y = i + widths/2 if side ==
|
|
813
|
+
median_y = i + widths/2 if side == "upper" else i - widths/2
|
|
810
814
|
|
|
811
815
|
# Find y-position on violin curve for mean
|
|
812
816
|
mean_mask = np.abs(verts[:, 0] - mean_val) < (np.ptp(x) * 0.01)
|
|
813
817
|
if mean_mask.any():
|
|
814
|
-
mean_y = np.max(verts[mean_mask, 1]) if side ==
|
|
818
|
+
mean_y = np.max(verts[mean_mask, 1]) if side == "upper" else np.min(verts[mean_mask, 1])
|
|
815
819
|
else:
|
|
816
|
-
mean_y = i + widths/2 if side ==
|
|
820
|
+
mean_y = i + widths/2 if side == "upper" else i - widths/2
|
|
817
821
|
|
|
818
822
|
# Triangle offset from curve
|
|
819
823
|
triangle_offset = 0.05
|
|
820
824
|
|
|
821
825
|
# Mean marker - triangle below curve pointing up
|
|
822
|
-
ax.scatter(mean_val, mean_y - triangle_offset, marker=
|
|
823
|
-
facecolor=colors[i-1], edgecolor=
|
|
826
|
+
ax.scatter(mean_val, mean_y - triangle_offset, marker="^", s=30,
|
|
827
|
+
facecolor=colors[i-1], edgecolor="black",
|
|
824
828
|
linewidth=0.5, zorder=6,
|
|
825
|
-
label=
|
|
829
|
+
label="Mean" if i == 1 else "")
|
|
826
830
|
|
|
827
831
|
# Mean value text - below the triangle
|
|
828
|
-
ax.text(mean_val, mean_y - triangle_offset - 0.
|
|
832
|
+
ax.text(mean_val, mean_y - triangle_offset - 0.08, f"mean: {mean_val:.2f} ± {std_val:.2f}", ha="center", va="top", fontsize=8, color="black", zorder=7)
|
|
829
833
|
|
|
830
834
|
# Median marker - triangle above curve pointing down
|
|
831
|
-
ax.scatter(median_val, median_y + triangle_offset, marker=
|
|
832
|
-
facecolor=colors[i-1], edgecolor=
|
|
835
|
+
ax.scatter(median_val, median_y + triangle_offset, marker="v", s=30,
|
|
836
|
+
facecolor=colors[i-1], edgecolor="black",
|
|
833
837
|
linewidth=0.5, zorder=6,
|
|
834
|
-
label=
|
|
838
|
+
label="Median" if i == 1 else "")
|
|
835
839
|
|
|
836
840
|
# Median value text - above the triangle
|
|
837
|
-
ax.text(median_val, median_y + triangle_offset + 0.
|
|
841
|
+
ax.text(median_val, median_y + triangle_offset + 0.08, f"median: {median_val:.2f}", ha="center", va="bottom", fontsize=8, color="black", zorder=7)
|
|
838
842
|
|
|
839
843
|
# --- Labels & formatting ---
|
|
840
844
|
ax.set_yticks(range(1, n + 1))
|
|
@@ -847,14 +851,14 @@ def hill_plot(*args, labels=None, xlabel=None, ylabel=None, title=None, widths=0
|
|
|
847
851
|
# Style improvements
|
|
848
852
|
ax.spines['top'].set_visible(False)
|
|
849
853
|
ax.spines['right'].set_visible(False)
|
|
850
|
-
ax.grid(axis='x', alpha=0.3, linestyle=
|
|
854
|
+
ax.grid(axis='x', alpha=0.3, linestyle="--", linewidth=0.5)
|
|
851
855
|
|
|
852
856
|
if xlabel:
|
|
853
|
-
ax.set_xlabel(xlabel, fontsize=11
|
|
857
|
+
ax.set_xlabel(xlabel, fontsize=11)
|
|
854
858
|
if ylabel:
|
|
855
|
-
ax.set_ylabel(ylabel, fontsize=11
|
|
859
|
+
ax.set_ylabel(ylabel, fontsize=11)
|
|
856
860
|
if title:
|
|
857
|
-
ax.set_title(title, fontsize=11,
|
|
861
|
+
ax.set_title(title, fontsize=11, pad=20)
|
|
858
862
|
|
|
859
863
|
plt.tight_layout()
|
|
860
864
|
plt.close()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
modusa-0.3.
|
|
2
|
-
modusa-0.3.
|
|
3
|
-
modusa-0.3.
|
|
4
|
-
modusa-0.3.
|
|
1
|
+
modusa-0.3.98.dist-info/METADATA,sha256=UWNpZNECamaQ4hWjDlUtjlKq8FekUXFaWqYASz4kzWg,1436
|
|
2
|
+
modusa-0.3.98.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
modusa-0.3.98.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
|
|
4
|
+
modusa-0.3.98.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
|
|
5
5
|
modusa/.DS_Store,sha256=_gm6qJREwfMi8dE7n5S89_RG46u5t3xHyD-smNhtNoM,6148
|
|
6
|
-
modusa/__init__.py,sha256=
|
|
6
|
+
modusa/__init__.py,sha256=tHymC1Qe3tgHvnjMcsWkpBlx6cKl7XTUfHoFE8ISKjI,318
|
|
7
7
|
modusa/config.py,sha256=bTqK4t00FZqERVITrxW_q284aDDJAa9aMSfFknfR-oU,280
|
|
8
8
|
modusa/decorators.py,sha256=8zeNX_wE37O6Vp0ysR4-WCZaEL8mq8dyCF_I5DHOzks,5905
|
|
9
9
|
modusa/devtools/generate_docs_source.py,sha256=UDflHsk-Yh9-3YJTVBzKL32y8hcxiRgAlFEBTMiDqwM,3301
|
|
@@ -51,7 +51,7 @@ modusa/tools/audio_recorder.py,sha256=K_LGqsPdjTdf3figEZTSQLmgMzYWgz18HTO8C1j5fE
|
|
|
51
51
|
modusa/tools/audio_saver.py,sha256=ldzfr_AydsHTnKbxmBLJblN-hLzTmOlppOm306xI4Ug,510
|
|
52
52
|
modusa/tools/base.py,sha256=C0ESJ0mIfjjRlAkRbSetNtMoOfS6IrHBjexRp3l_Mh4,1293
|
|
53
53
|
modusa/tools/math_ops.py,sha256=ZZ7U4DgqT7cOeE7_Lzi_Qq-48WYfwR9_osbZwTmE9eg,8690
|
|
54
|
-
modusa/tools/plotter.py,sha256=
|
|
54
|
+
modusa/tools/plotter.py,sha256=QUGeidPqMkkvpF3QEAPlFTBMrgu-8Ex1dDHxWRlmUGk,29920
|
|
55
55
|
modusa/tools/youtube_downloader.py,sha256=hB_X8-7nOHXOlxg6vv3wyhBLoAsWyomrULP6_uCQL7s,1698
|
|
56
56
|
modusa/utils/.DS_Store,sha256=nLXMwF7QJNuglLI_Gk74F7vl5Dyus2Wd74Mgowijmdo,6148
|
|
57
57
|
modusa/utils/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
|
|
@@ -60,4 +60,4 @@ modusa/utils/excp.py,sha256=L9vhaGjKpv9viJYdmC9n5ndmk2GVbUBuFyZyhAQZmWY,906
|
|
|
60
60
|
modusa/utils/logger.py,sha256=K0rsnObeNKCxlNeSnVnJeRhgfmob6riB2uyU7h3dDmA,571
|
|
61
61
|
modusa/utils/np_func_cat.py,sha256=TyIFgRc6bARRMDnZxlVURO5Z0I-GWhxRONYyIv-Vwxs,1007
|
|
62
62
|
modusa/utils/plot.py,sha256=s_vNdxvKfwxEngvJPgrF1PcmxZNnNaaXPViHWjyjJ-c,5335
|
|
63
|
-
modusa-0.3.
|
|
63
|
+
modusa-0.3.98.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|