direl-ts-tool-kit 0.7.0__py3-none-any.whl → 0.8.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.
- direl_ts_tool_kit/plot/plot_ts.py +77 -0
- {direl_ts_tool_kit-0.7.0.dist-info → direl_ts_tool_kit-0.8.0.dist-info}/METADATA +1 -1
- {direl_ts_tool_kit-0.7.0.dist-info → direl_ts_tool_kit-0.8.0.dist-info}/RECORD +6 -6
- {direl_ts_tool_kit-0.7.0.dist-info → direl_ts_tool_kit-0.8.0.dist-info}/WHEEL +0 -0
- {direl_ts_tool_kit-0.7.0.dist-info → direl_ts_tool_kit-0.8.0.dist-info}/licenses/LICENCE +0 -0
- {direl_ts_tool_kit-0.7.0.dist-info → direl_ts_tool_kit-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -471,3 +471,80 @@ def plot_histogram(df, variable, units="", density=True, color="BLUE_BARS", bins
|
|
|
471
471
|
ax.grid(alpha=0.8, linestyle="--")
|
|
472
472
|
|
|
473
473
|
return fig
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def plot_data_boxplot(
|
|
477
|
+
df, variable=None, x_label="", y_label="", grid=False, notch=False
|
|
478
|
+
):
|
|
479
|
+
"""
|
|
480
|
+
Generates a boxplot visualization, either for all numerical columns in the
|
|
481
|
+
DataFrame or for a single specified variable.
|
|
482
|
+
|
|
483
|
+
The function applies consistent styling for the boxes, outliers, and median
|
|
484
|
+
lines using predefined colors from 'paper_colors'.
|
|
485
|
+
|
|
486
|
+
Parameters
|
|
487
|
+
----------
|
|
488
|
+
df : pd.DataFrame
|
|
489
|
+
The input DataFrame containing the data to be plotted.
|
|
490
|
+
variable : str, optional
|
|
491
|
+
The column name of the variable to plot.
|
|
492
|
+
- If None (default), boxplots for all numerical columns in the DataFrame
|
|
493
|
+
are generated side-by-side.
|
|
494
|
+
- If a string, a single boxplot for that column is generated.
|
|
495
|
+
x_label : str, optional
|
|
496
|
+
The label for the X-axis. Defaults to "".
|
|
497
|
+
y_label : str, optional
|
|
498
|
+
The label for the Y-axis. Defaults to "".
|
|
499
|
+
grid : bool, optional
|
|
500
|
+
If True, display the grid lines on the plot. This parameter is only
|
|
501
|
+
effective when plotting **all** variables (when `variable` is None).
|
|
502
|
+
Defaults to False.
|
|
503
|
+
notch : bool, optional
|
|
504
|
+
If True, draw a notch around the median. This parameter is only
|
|
505
|
+
effective when plotting **all** variables (when `variable` is None).
|
|
506
|
+
Defaults to False.
|
|
507
|
+
|
|
508
|
+
Returns
|
|
509
|
+
-------
|
|
510
|
+
matplotlib.figure.Figure
|
|
511
|
+
The generated Matplotlib Figure object containing the boxplot(s).
|
|
512
|
+
|
|
513
|
+
Notes
|
|
514
|
+
-----
|
|
515
|
+
The boxplot uses the following fixed style parameters:
|
|
516
|
+
- **Box Line Color:** BLUE_LINES
|
|
517
|
+
- **Outlier Marker:** 'o' (marker size 12)
|
|
518
|
+
- **Median Line Color:** GREEN_LINES
|
|
519
|
+
|
|
520
|
+
When plotting a single variable (`variable` is set), the `grid` and
|
|
521
|
+
`notch` parameters are internally forced to **False**.
|
|
522
|
+
"""
|
|
523
|
+
boxprops = dict(linewidth=4, color=paper_colors["BLUE_LINES"])
|
|
524
|
+
flierprops = dict(marker="o", markersize=12)
|
|
525
|
+
medianprops = dict(linewidth=4, color=paper_colors["GREEN_LINES"])
|
|
526
|
+
|
|
527
|
+
fig, ax = plt.subplots()
|
|
528
|
+
|
|
529
|
+
if not variable:
|
|
530
|
+
ax = df.boxplot(
|
|
531
|
+
grid=grid,
|
|
532
|
+
notch=notch,
|
|
533
|
+
boxprops=boxprops,
|
|
534
|
+
flierprops=flierprops,
|
|
535
|
+
medianprops=medianprops,
|
|
536
|
+
)
|
|
537
|
+
else:
|
|
538
|
+
ax = df[[variable]].boxplot(
|
|
539
|
+
grid=False,
|
|
540
|
+
notch=False,
|
|
541
|
+
boxprops=boxprops,
|
|
542
|
+
flierprops=flierprops,
|
|
543
|
+
medianprops=medianprops,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
ax.set_xlabel(f"{x_label}")
|
|
547
|
+
ax.set_ylabel(f"{y_label}")
|
|
548
|
+
ax.tick_params(axis="x")
|
|
549
|
+
|
|
550
|
+
return fig
|
|
@@ -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=
|
|
4
|
+
direl_ts_tool_kit/plot/plot_ts.py,sha256=eyv7MLZNiZAPGHj7EJVwt1odsF9MOkBvbx731isB7Yc,17376
|
|
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.
|
|
8
|
-
direl_ts_tool_kit-0.
|
|
9
|
-
direl_ts_tool_kit-0.
|
|
10
|
-
direl_ts_tool_kit-0.
|
|
11
|
-
direl_ts_tool_kit-0.
|
|
7
|
+
direl_ts_tool_kit-0.8.0.dist-info/licenses/LICENCE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
direl_ts_tool_kit-0.8.0.dist-info/METADATA,sha256=oF75eBNRbt-j61YbbSAHtz2HfF6CizO2QCcYeSgLu-E,5196
|
|
9
|
+
direl_ts_tool_kit-0.8.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
direl_ts_tool_kit-0.8.0.dist-info/top_level.txt,sha256=vMCRudnGnsdRg_6fUftnG8PF2Y1m0bjBDMf3pCAp6bc,18
|
|
11
|
+
direl_ts_tool_kit-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|