direl-ts-tool-kit 0.6.0__py3-none-any.whl → 0.7.0__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.
@@ -412,3 +412,62 @@ def pair_plot(X, y):
412
412
  fig = svm.fig
413
413
 
414
414
  return fig
415
+
416
+
417
+ def plot_histogram(df, variable, units="", density=True, color="BLUE_BARS", bins=30):
418
+ """
419
+ Generates a histogram plot for a specified numerical variable.
420
+
421
+ The plot visualizes the distribution of the data, with the Y-axis dynamically
422
+ labeled as 'Density' or 'Count' based on the `density` parameter.
423
+
424
+ Parameters
425
+ ----------
426
+ df : pd.DataFrame
427
+ The DataFrame containing the data to be plotted.
428
+ variable : str
429
+ The name of the column in 'df' whose distribution will be plotted.
430
+ units : str, optional
431
+ Units to display next to the variable name on the X-axis. Defaults to "".
432
+ density : bool, optional
433
+ If True (default), the Y-axis is scaled to a Probability Density,
434
+ meaning the area under the bars sums to 1. If False, the Y-axis
435
+ displays the raw count of observations per bin.
436
+ color : str, optional
437
+ Key corresponding to the bar color in the global 'paper_colors' dictionary
438
+ (e.g., "BLUE_BARS"). Defaults to "BLUE_LINES".
439
+ bins : int or sequence, optional
440
+ The number of equal-width bins in the range to divide the data.
441
+ Can be an integer (default is 30) or a sequence specifying the bin edges.
442
+
443
+ Returns
444
+ -------
445
+ matplotlib.figure.Figure
446
+ The generated Matplotlib Figure object containing the histogram.
447
+
448
+ Notes
449
+ -----
450
+ The plot applies a fixed style (alpha=0.7, white edge-color) and grid
451
+ for visual consistency.
452
+ """
453
+ fig, ax = plt.subplots()
454
+
455
+ ax.hist(
456
+ df[variable],
457
+ bins=bins,
458
+ density=density,
459
+ alpha=0.7,
460
+ color=paper_colors[color],
461
+ edgecolor="white",
462
+ )
463
+
464
+ ax.set_xlabel(f"{variable} {units}")
465
+
466
+ if density:
467
+ ax.set_ylabel("Density")
468
+ else:
469
+ ax.set_ylabel("Count")
470
+
471
+ ax.grid(alpha=0.8, linestyle="--")
472
+
473
+ return fig
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: direl-ts-tool-kit
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: A toolbox for time series analysis and visualization.
5
5
  Home-page: https://gitlab.com/direl/direl_tool_kit
6
6
  Author: Diego Restrepo-Leal
@@ -125,6 +125,14 @@ It focuses on the lower triangular part (corner=True) and includes a
125
125
  regression line for trend visualization.
126
126
 
127
127
 
128
+ #### plot_histogram
129
+ `plot_histogram(df, variable, units="", density=True, color="BLUE_BARS", bins=30)`
130
+
131
+ Generates a histogram plot for a specified numerical variable.
132
+
133
+ The plot visualizes the distribution of the data, with the Y-axis dynamically
134
+ labeled as 'Density' or 'Count' based on the `density` parameter.
135
+
128
136
  # Examples
129
137
  - [Example 1](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_01.md?ref_type=heads)
130
138
  - [Example 2](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_02.md?ref_type=heads)
@@ -1,11 +1,11 @@
1
1
  direl_ts_tool_kit/__init__.py,sha256=W99Wd3BeEFKOxT51TApURElbDJvqIjD8u_-qDoCYSJ0,94
2
2
  direl_ts_tool_kit/plot/__init__.py,sha256=CMwyv-kiE74nwr3MJPL7gWIJmcfZ8UQCRu7mBGGQ4rI,49
3
3
  direl_ts_tool_kit/plot/plot_style.py,sha256=5YxoLXlYvzleTnBEGPwCmHQIJ0S96KPJspq_n-qMvpw,1069
4
- direl_ts_tool_kit/plot/plot_ts.py,sha256=D1doDV24eKOFD7vxZUE6QRx-kTRPPjmbxcGOnvdVjKQ,12982
4
+ direl_ts_tool_kit/plot/plot_ts.py,sha256=E8oswirgUyzojKRvUA39MiZqplCFMMmIJtYBDOOM4JM,14839
5
5
  direl_ts_tool_kit/utilities/__init__.py,sha256=jMtxYZUtwlhgI99sxe_8MMzsDnxtbTP7Ivh9tUOeIwQ,25
6
6
  direl_ts_tool_kit/utilities/data_prep.py,sha256=k3eOwQEEd5mxy2DtT_Gdo7BhkzEmSQqvMJ89y8mH5CQ,6024
7
- direl_ts_tool_kit-0.6.0.dist-info/licenses/LICENCE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- direl_ts_tool_kit-0.6.0.dist-info/METADATA,sha256=4G6DKqzMbNny1JE26bGSUuX5zpDqf-4VDuvjwgMZjLI,4883
9
- direl_ts_tool_kit-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- direl_ts_tool_kit-0.6.0.dist-info/top_level.txt,sha256=vMCRudnGnsdRg_6fUftnG8PF2Y1m0bjBDMf3pCAp6bc,18
11
- direl_ts_tool_kit-0.6.0.dist-info/RECORD,,
7
+ direl_ts_tool_kit-0.7.0.dist-info/licenses/LICENCE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ direl_ts_tool_kit-0.7.0.dist-info/METADATA,sha256=UTxeb67A2nbjkUDpPd2tAP_7GgEc4KRmaawwDz2fzG4,5196
9
+ direl_ts_tool_kit-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ direl_ts_tool_kit-0.7.0.dist-info/top_level.txt,sha256=vMCRudnGnsdRg_6fUftnG8PF2Y1m0bjBDMf3pCAp6bc,18
11
+ direl_ts_tool_kit-0.7.0.dist-info/RECORD,,