modusa 0.3.50__py3-none-any.whl → 0.3.51__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 CHANGED
@@ -915,14 +915,14 @@ class Fig:
915
915
 
916
916
  """
917
917
 
918
- def __init__(self, arrangement="asm", title="Untitled", xlabel="Time (sec)", xlim=None):
918
+ def __init__(self, arrangement="asm", xlim=None):
919
919
 
920
920
  self._xlim = xlim
921
921
  self._curr_row_idx = 1 # Starting from 1 because row 0 is reserved for reference subplot
922
922
  self._curr_color_idx = 0 # So that we have different color across all the subplots to avoid legend confusion
923
923
 
924
924
  # Subplot setup
925
- self._fig, self._axs = self._generate_subplots(arrangement, title, xlabel) # This will fill in the all the above variables
925
+ self._fig, self._axs = self._generate_subplots(arrangement) # This will fill in the all the above variables
926
926
 
927
927
 
928
928
  def _get_curr_row(self):
@@ -958,7 +958,7 @@ class Fig:
958
958
  return [x[0] - dx / 2, x[-1] + dx / 2, y[0] - dy / 2, y[-1] + dy / 2]
959
959
 
960
960
 
961
- def _generate_subplots(self, arrangement, title, xlabel):
961
+ def _generate_subplots(self, arrangement):
962
962
  """
963
963
  Generate subplots based on the configuration.
964
964
  """
@@ -1013,12 +1013,6 @@ class Fig:
1013
1013
  # xlim should be applied on reference subplot, rest all subplots will automatically adjust
1014
1014
  if xlim is not None:
1015
1015
  axs[0, 0].set_xlim(xlim)
1016
-
1017
- # Set title and label
1018
- if title is not None:
1019
- axs[0, 0].set_title(title)
1020
- if xlabel is not None:
1021
- axs[-1, 0].set_xlabel(xlabel)
1022
1016
 
1023
1017
  fig.subplots_adjust(hspace=0.2, wspace=0.05)
1024
1018
 
@@ -1285,6 +1279,47 @@ class Fig:
1285
1279
  # remove duplicates if needed
1286
1280
  fig.legend(all_handles, all_labels, loc='upper right', bbox_to_anchor=(0.95, ypos), ncol=2, frameon=True, bbox_transform=fig.transFigure)
1287
1281
 
1282
+ def add_title(self, title=None, s=13):
1283
+ """
1284
+ Add title to the figure.
1285
+
1286
+ Parameters
1287
+ ----------
1288
+ title: str | None
1289
+ - Title of the figure.
1290
+ - Default: None
1291
+ s: Number
1292
+ - Font size.
1293
+ - Default: None
1294
+ """
1295
+ axs = self._axs
1296
+ ref_ax = axs[0, 0] # Title is added to the top subplot (ref subplot)
1297
+
1298
+ if title is not None:
1299
+ ref_ax.set_title(title, pad=10, size=s)
1300
+
1301
+
1302
+ def add_xlabel(self, xlabel=None, s=None):
1303
+ """
1304
+ Add shared x-label to the figure.
1305
+
1306
+ Parameters
1307
+ ----------
1308
+ xlabel: str | None
1309
+ - xlabel for the figure.
1310
+ - Default: None
1311
+ s: Number
1312
+ - Font size.
1313
+ - Default: None
1314
+ """
1315
+ axs = self._axs
1316
+ ref_ax = axs[-1, 0] # X-label is added to the last subplot
1317
+ if xlabel is not None:
1318
+ ref_ax.set_xlabel(xlabel, size=s)
1319
+
1320
+ def add_xticks():
1321
+ raise NotImplementedError("Please raise a github issue `https://github.com/meluron-toolbox/modusa/issues`")
1322
+
1288
1323
  def save(self, path="./figure.png"):
1289
1324
  """
1290
1325
  Save the figure.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modusa
3
- Version: 0.3.50
3
+ Version: 0.3.51
4
4
  Summary: A modular signal analysis python library.
5
5
  Author-Email: Ankit Anand <ankit0.anand0@gmail.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- modusa-0.3.50.dist-info/METADATA,sha256=_Zs_SXu7wtVHvknOekARTFPVX79zcBbgcSgNU4AVYZM,1436
2
- modusa-0.3.50.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- modusa-0.3.50.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
4
- modusa-0.3.50.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
1
+ modusa-0.3.51.dist-info/METADATA,sha256=Z_j4qx-H1R16_hDhBJDu-fv8WBFcHfUsQGzN9zOanC4,1436
2
+ modusa-0.3.51.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ modusa-0.3.51.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
4
+ modusa-0.3.51.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=_Fk3GxsI0GT-uhsZaHgs6p5YcIkqPGb3s78_dzFy1lE,291
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=x3hOBWg1hNg0iGBIJR2mrgjlhQBQ0HOnjNv_h6pqJ5c,34358
53
+ modusa/tools/plotter.py,sha256=KD15NHcOU-vA-12VTk5qYYXuiSdhCpwd2QFjkx76I4E,35040
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.50.dist-info/RECORD,,
62
+ modusa-0.3.51.dist-info/RECORD,,