onekit 2.2.0__tar.gz → 2.2.2__tar.gz
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.
- {onekit-2.2.0 → onekit-2.2.2}/PKG-INFO +1 -1
- {onekit-2.2.0 → onekit-2.2.2}/pyproject.toml +1 -1
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/vizkit.py +24 -18
- {onekit-2.2.0 → onekit-2.2.2}/LICENSE +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/README.md +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/__init__.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/dekit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/mathkit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/numpykit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/optfunckit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/pandaskit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/pythonkit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/sklearnkit.py +0 -0
- {onekit-2.2.0 → onekit-2.2.2}/src/onekit/sparkkit.py +0 -0
|
@@ -15,6 +15,8 @@ from mpl_toolkits.mplot3d.axes3d import Axes3D
|
|
|
15
15
|
from onekit import numpykit as npk
|
|
16
16
|
from onekit import pythonkit as pk
|
|
17
17
|
|
|
18
|
+
ArrayLike = npt.ArrayLike
|
|
19
|
+
|
|
18
20
|
__all__ = (
|
|
19
21
|
"Config",
|
|
20
22
|
"FunctionPlotter",
|
|
@@ -484,14 +486,13 @@ def plot_contour(
|
|
|
484
486
|
|
|
485
487
|
|
|
486
488
|
def plot_digitscale(
|
|
487
|
-
x,
|
|
488
|
-
|
|
489
|
-
*,
|
|
489
|
+
x: ArrayLike,
|
|
490
|
+
y: ArrayLike | None = None,
|
|
490
491
|
cmap_name: str = "YlOrBr_r",
|
|
491
492
|
kws_plot: dict[str, str] | None = None,
|
|
492
493
|
ax=None,
|
|
493
494
|
) -> Axes:
|
|
494
|
-
"""Plot a scaled version of :math:`
|
|
495
|
+
"""Plot a digit-scaled version of :math:`y` against :math:`x`.
|
|
495
496
|
|
|
496
497
|
See Also
|
|
497
498
|
--------
|
|
@@ -507,34 +508,39 @@ def plot_digitscale(
|
|
|
507
508
|
|
|
508
509
|
kwargs_plot = dict(marker=".", color="black")
|
|
509
510
|
kwargs_plot.update(kws_plot or dict())
|
|
511
|
+
for k in ["x", "y"]:
|
|
512
|
+
kwargs_plot.pop(k, None)
|
|
513
|
+
|
|
514
|
+
if y is None:
|
|
515
|
+
y = x
|
|
516
|
+
x = np.arange(len(y))
|
|
510
517
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
ax.plot(
|
|
518
|
+
y_values = np.asarray(y)
|
|
519
|
+
y_scaled = npk.digitscale(y_values)
|
|
520
|
+
ax.plot(x, y_scaled, **kwargs_plot)
|
|
514
521
|
x_limits = ax.get_xlim()
|
|
515
522
|
|
|
516
|
-
y_min = int(np.floor(
|
|
517
|
-
y_max = int(np.ceil(
|
|
523
|
+
y_min = int(np.floor(y_scaled.min()))
|
|
524
|
+
y_max = int(np.ceil(y_scaled.max()))
|
|
518
525
|
y_range = tuple(range(y_min, y_max))
|
|
519
526
|
colors = discrete_cmap(y_max, name=cmap_name, lower_bound=0.2, upper_bound=0.8)
|
|
520
527
|
|
|
521
|
-
for i,
|
|
522
|
-
ax.fill_between(x_limits,
|
|
528
|
+
for i, yi in enumerate(y_range):
|
|
529
|
+
ax.fill_between(x_limits, yi, yi + 1, color=colors[i], alpha=0.3)
|
|
523
530
|
|
|
524
531
|
ax.set_xlim(x_limits)
|
|
525
532
|
ax.set_yticks(y_range)
|
|
526
533
|
|
|
527
|
-
ax.
|
|
528
|
-
ax.set_ylabel("num_digits(orig_value)")
|
|
534
|
+
ax.set_ylabel("num_digits(orig_value)", labelpad=6)
|
|
529
535
|
|
|
530
536
|
ax.set_title(
|
|
531
537
|
pk.concat_strings(
|
|
532
538
|
", ",
|
|
533
|
-
f"mean={pk.num_to_str(
|
|
534
|
-
f"median={pk.num_to_str(float(np.median(
|
|
535
|
-
f"std={pk.num_to_str(
|
|
536
|
-
f"min={pk.num_to_str(
|
|
537
|
-
f"max={pk.num_to_str(
|
|
539
|
+
f"mean={pk.num_to_str(y_values.mean())}",
|
|
540
|
+
f"median={pk.num_to_str(float(np.median(y_values)))}",
|
|
541
|
+
f"std={pk.num_to_str(y_values.std(ddof=1))}",
|
|
542
|
+
f"min={pk.num_to_str(y_values.min())}",
|
|
543
|
+
f"max={pk.num_to_str(y_values.max())}",
|
|
538
544
|
),
|
|
539
545
|
size="medium",
|
|
540
546
|
pad=12,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|