maidr 1.3.0__py3-none-any.whl → 1.4.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.
- maidr/__init__.py +2 -1
- maidr/core/plot/candlestick.py +87 -203
- maidr/core/plot/maidr_plot.py +7 -2
- maidr/core/plot/maidr_plot_factory.py +12 -11
- maidr/core/plot/mplfinance_barplot.py +115 -0
- maidr/core/plot/mplfinance_lineplot.py +146 -0
- maidr/patch/__init__.py +15 -0
- maidr/patch/mplfinance.py +213 -0
- maidr/util/__init__.py +3 -0
- maidr/util/mplfinance_utils.py +409 -0
- maidr/util/plot_detection.py +136 -0
- {maidr-1.3.0.dist-info → maidr-1.4.0.dist-info}/METADATA +1 -1
- {maidr-1.3.0.dist-info → maidr-1.4.0.dist-info}/RECORD +15 -10
- {maidr-1.3.0.dist-info → maidr-1.4.0.dist-info}/LICENSE +0 -0
- {maidr-1.3.0.dist-info → maidr-1.4.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utility functions for detecting plot types and determining appropriate plot classes.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from matplotlib.axes import Axes
|
|
6
|
+
from matplotlib.lines import Line2D
|
|
7
|
+
from typing import Dict, Any, List, Union
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PlotDetectionUtils:
|
|
11
|
+
"""
|
|
12
|
+
Utility class for detecting plot characteristics and determining appropriate plot classes.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def is_mplfinance_bar_plot(**kwargs) -> bool:
|
|
17
|
+
"""
|
|
18
|
+
Detect if this is an mplfinance bar plot based on kwargs.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
**kwargs : dict
|
|
23
|
+
Keyword arguments passed to the plot factory
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
bool
|
|
28
|
+
True if this is an mplfinance bar plot
|
|
29
|
+
"""
|
|
30
|
+
return "_maidr_patches" in kwargs or "_maidr_date_nums" in kwargs
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def is_mplfinance_line_plot(ax: Axes, **kwargs) -> bool:
|
|
34
|
+
"""
|
|
35
|
+
Detect if this is an mplfinance line plot based on kwargs or Line2D attributes.
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
ax : Axes
|
|
40
|
+
The matplotlib axes object
|
|
41
|
+
**kwargs : dict
|
|
42
|
+
Keyword arguments passed to the plot factory
|
|
43
|
+
|
|
44
|
+
Returns
|
|
45
|
+
-------
|
|
46
|
+
bool
|
|
47
|
+
True if this is an mplfinance line plot
|
|
48
|
+
"""
|
|
49
|
+
# Check kwargs first (more efficient)
|
|
50
|
+
if "_maidr_date_nums" in kwargs:
|
|
51
|
+
return True
|
|
52
|
+
|
|
53
|
+
# Check Line2D objects for mplfinance attributes
|
|
54
|
+
try:
|
|
55
|
+
for line in ax.get_lines():
|
|
56
|
+
if isinstance(line, Line2D) and hasattr(line, "_maidr_date_nums"):
|
|
57
|
+
return True
|
|
58
|
+
except (AttributeError, TypeError):
|
|
59
|
+
# Handle cases where ax doesn't have get_lines() method (e.g., Mock objects)
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def is_mplfinance_candlestick_plot(**kwargs) -> bool:
|
|
66
|
+
"""
|
|
67
|
+
Detect if this is an mplfinance candlestick plot based on kwargs.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
**kwargs : dict
|
|
72
|
+
Keyword arguments passed to the plot factory
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
bool
|
|
77
|
+
True if this is an mplfinance candlestick plot
|
|
78
|
+
"""
|
|
79
|
+
return any(key.startswith("_maidr_") for key in kwargs.keys())
|
|
80
|
+
|
|
81
|
+
@staticmethod
|
|
82
|
+
def should_use_candlestick_plot(
|
|
83
|
+
ax: Union[Axes, List[Axes], List[List[Axes]]], **kwargs
|
|
84
|
+
) -> bool:
|
|
85
|
+
"""
|
|
86
|
+
Determine if a candlestick plot should be used based on axes structure.
|
|
87
|
+
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
ax : Union[Axes, List[Axes], List[List[Axes]]]
|
|
91
|
+
The matplotlib axes object(s)
|
|
92
|
+
**kwargs : dict
|
|
93
|
+
Keyword arguments passed to the plot factory
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
-------
|
|
97
|
+
bool
|
|
98
|
+
True if candlestick plot should be used
|
|
99
|
+
"""
|
|
100
|
+
# Check if we have mplfinance-specific kwargs
|
|
101
|
+
if PlotDetectionUtils.is_mplfinance_candlestick_plot(**kwargs):
|
|
102
|
+
return True
|
|
103
|
+
|
|
104
|
+
# Check if we have a list of axes (typical for candlestick plots)
|
|
105
|
+
if isinstance(ax, list):
|
|
106
|
+
return True
|
|
107
|
+
|
|
108
|
+
return False
|
|
109
|
+
|
|
110
|
+
@staticmethod
|
|
111
|
+
def get_candlestick_axes(
|
|
112
|
+
ax: Union[Axes, List[Axes], List[List[Axes]]]
|
|
113
|
+
) -> List[Axes]:
|
|
114
|
+
"""
|
|
115
|
+
Extract and normalize axes for candlestick plots.
|
|
116
|
+
|
|
117
|
+
Parameters
|
|
118
|
+
----------
|
|
119
|
+
ax : Union[Axes, List[Axes], List[List[Axes]]]
|
|
120
|
+
The matplotlib axes object(s)
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
-------
|
|
124
|
+
List[Axes]
|
|
125
|
+
Normalized list of axes for candlestick plotting
|
|
126
|
+
"""
|
|
127
|
+
if isinstance(ax, list):
|
|
128
|
+
if ax and isinstance(ax[0], list):
|
|
129
|
+
# Handle nested list case: [[ax1, ax2]]
|
|
130
|
+
return ax[0]
|
|
131
|
+
else:
|
|
132
|
+
# Handle simple list case: [ax1, ax2]
|
|
133
|
+
return ax
|
|
134
|
+
else:
|
|
135
|
+
# Handle single axis case
|
|
136
|
+
return [ax]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: maidr
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Multimodal Access and Interactive Data Representations
|
|
5
5
|
License: GPL-3.0-or-later
|
|
6
6
|
Keywords: accessibility,visualization,sonification,braille,tactile,multimodal,data representation,blind,low vision,visual impairments
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
maidr/__init__.py,sha256=
|
|
1
|
+
maidr/__init__.py,sha256=RJ2I0a9M__hF_MmMmToPHiRV0h8rZUJ_kb7AlMKx-R4,415
|
|
2
2
|
maidr/api.py,sha256=F43mXWsxc7tHdlZqbRlEWkc-RjJVo_zgxCn3NiLBY58,1764
|
|
3
3
|
maidr/core/__init__.py,sha256=WgxLpSEYMc4k3OyEOf1shOxfEq0ASzppEIZYmE91ThQ,25
|
|
4
4
|
maidr/core/context_manager.py,sha256=6cT7ZGOApSpC-SLD2XZWWU_H08i-nfv-JUlzXOtvWYw,3374
|
|
@@ -12,18 +12,20 @@ maidr/core/maidr.py,sha256=kpN5axfJnWyaqXvyA1maioPOFh1rqod3XIvhIefcjOs,14225
|
|
|
12
12
|
maidr/core/plot/__init__.py,sha256=xDIpRGM-4DfaSSL3nKcXrjdMecCHJ6en4K4nA_fPefQ,83
|
|
13
13
|
maidr/core/plot/barplot.py,sha256=1HfoqyDGKIXkYQnCHN83Ye_faKpNQ3R4wjlbjD5jUyk,2092
|
|
14
14
|
maidr/core/plot/boxplot.py,sha256=i11GdNuz_c-hilmhydu3ah-bzyVdFoBkNvRi5lpMrrY,9946
|
|
15
|
-
maidr/core/plot/candlestick.py,sha256=
|
|
15
|
+
maidr/core/plot/candlestick.py,sha256=vT_QL48XAWw-rwFB635faSBfwsS3SYFr3hplndLQOpc,4584
|
|
16
16
|
maidr/core/plot/grouped_barplot.py,sha256=bRcQcvwkF3Q3aZ3PlhbZ6bHI_AfcqdKUMVvlLL94wXM,2078
|
|
17
17
|
maidr/core/plot/heatmap.py,sha256=yMS-31tS2GW4peds9LtZesMxmmTV_YfqYO5M_t5KasQ,2521
|
|
18
18
|
maidr/core/plot/histogram.py,sha256=QV5W-6ZJQQcZsrM91JJBX-ONktJzH7yg_et5_bBPfQQ,1525
|
|
19
19
|
maidr/core/plot/lineplot.py,sha256=C3xz6uWXYM_mbTq_geb5bP0JdvhcQf6cpfTs78Y6fCM,3852
|
|
20
|
-
maidr/core/plot/maidr_plot.py,sha256=
|
|
21
|
-
maidr/core/plot/maidr_plot_factory.py,sha256=
|
|
20
|
+
maidr/core/plot/maidr_plot.py,sha256=DN4TTRNt_SCqGa_mbkHrnpCk-eUQm71HoFRqs3bB6xk,3868
|
|
21
|
+
maidr/core/plot/maidr_plot_factory.py,sha256=NW2iFScswgXbAC9rAOo4iMkAFsjY43DAvFioGr0yzx4,2732
|
|
22
|
+
maidr/core/plot/mplfinance_barplot.py,sha256=AU9Y8dzt3mFH_tWoRT9aYU1X32q0N8AvczImleUMiXY,4399
|
|
23
|
+
maidr/core/plot/mplfinance_lineplot.py,sha256=D5j8EPsHojmTd1xCZG4Hy0NGBqg9zdLjKdtOdUlMk4k,5233
|
|
22
24
|
maidr/core/plot/regplot.py,sha256=b7u6bGTz1IxKahplNUrfwIr_OGSwMJ2BuLgFAVjL0s0,2744
|
|
23
25
|
maidr/core/plot/scatterplot.py,sha256=o0i0uS-wXK9ZrENxneoHbh3-u-2goRONp19Yu9QLsaY,1257
|
|
24
26
|
maidr/exception/__init__.py,sha256=PzaXoYBhyZxMDcJkuxJugDx7jZeseI0El6LpxIwXyG4,46
|
|
25
27
|
maidr/exception/extraction_error.py,sha256=rd37Oxa9gn2OWFWt9AOH5fv0hNd3sAWGvpDMFBuJY2I,607
|
|
26
|
-
maidr/patch/__init__.py,sha256=
|
|
28
|
+
maidr/patch/__init__.py,sha256=FnkoUQJC2ODhLO37GwgRVSitBCRax42Ti0e4NIAgdO0,236
|
|
27
29
|
maidr/patch/barplot.py,sha256=nxgBWBMUyf3eAW56CN5EKYYy3vsTgEPRlcvNYS3-WiU,2479
|
|
28
30
|
maidr/patch/boxplot.py,sha256=l7wDD4pDi4ZbsL5EX5XDhPRxgtSIFSrFguMOZ7IC2eg,2845
|
|
29
31
|
maidr/patch/candlestick.py,sha256=NFkzwpxmLBpWmb5s05pjk6obNMQee-xIEZTqGkbhhqM,1776
|
|
@@ -34,19 +36,22 @@ maidr/patch/highlight.py,sha256=I1dGFHJAnVd0AHVnMJzk_TE8BC8Uv-I6fTzSrJLU5QM,1155
|
|
|
34
36
|
maidr/patch/histogram.py,sha256=k3N0RUf1SQ2402pwbaY5QyS98KnLWvr9glCHQw9NTko,2378
|
|
35
37
|
maidr/patch/kdeplot.py,sha256=qv-OKzuop2aTrkZgUe2OnLxvV-KMyeXt1Td0_uZeHzE,2338
|
|
36
38
|
maidr/patch/lineplot.py,sha256=og42V0tWBKCnf6idT3pLsIj3QBvKjg8aUN-k1udPRVw,1901
|
|
39
|
+
maidr/patch/mplfinance.py,sha256=GU0ynZVA1hnKMNQIGNY8yQ-gOWdt-0s98ozGT0ayLOA,7890
|
|
37
40
|
maidr/patch/regplot.py,sha256=Ciz43C5XZfWK6wtVWrlV0WNz4R__rcgdqVE9OCaXXRk,3236
|
|
38
41
|
maidr/patch/scatterplot.py,sha256=kln6zZwjVsdQzICalo-RnBOJrx1BnIB2xYUwItHvSNY,525
|
|
39
|
-
maidr/util/__init__.py,sha256=
|
|
42
|
+
maidr/util/__init__.py,sha256=eRJZfRpDX-n7UoV3JXw_9Lbfu_qNl_D0W1UTvLL-Iv4,81
|
|
40
43
|
maidr/util/dedup_utils.py,sha256=RpgPL5p-3oULUHaTCZJaQKhPHfyPkvBLHMt8lAGpJ5A,438
|
|
41
44
|
maidr/util/environment.py,sha256=-2LyZUpHojBCMEbkr_xkcC-_IDqtGDALB8683v7kTdI,5253
|
|
42
45
|
maidr/util/mixin/__init__.py,sha256=aGJZNhtWh77yIVPc7ipIZm1OajigjMtCWYKPuDWTC-c,217
|
|
43
46
|
maidr/util/mixin/extractor_mixin.py,sha256=oHtwpmS5kARvaLrSO3DKTPQxyFUw9nOcKN7rzTj1q4g,5192
|
|
44
47
|
maidr/util/mixin/merger_mixin.py,sha256=V0qLw_6DUB7X6CQ3BCMpsCQX_ZuwAhoSTm_E4xAJFKM,712
|
|
48
|
+
maidr/util/mplfinance_utils.py,sha256=AvDzvAAQbMsPZxcxWr3DwctZMp4xW5CkQEBezWTk1mY,13704
|
|
49
|
+
maidr/util/plot_detection.py,sha256=bVSocZMGCLP6CduRSpOmwIzLFWEBnNdYN9T1ULfVPMw,3893
|
|
45
50
|
maidr/util/regression_line_utils.py,sha256=P8RQLixTby2JLz73XZgNiu96C2Ct3pNe4ENRWOjgT8M,509
|
|
46
51
|
maidr/util/svg_utils.py,sha256=2gyzBtNKFHs0utrw1iOlxTmznzivOWQMV2aW8zu2c8E,1442
|
|
47
52
|
maidr/widget/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
53
|
maidr/widget/shiny.py,sha256=wrrw2KAIpE_A6CNQGBtNHauR1DjenA_n47qlFXX9_rk,745
|
|
49
|
-
maidr-1.
|
|
50
|
-
maidr-1.
|
|
51
|
-
maidr-1.
|
|
52
|
-
maidr-1.
|
|
54
|
+
maidr-1.4.0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
55
|
+
maidr-1.4.0.dist-info/METADATA,sha256=0N1VB59PGbv3IEBZrkDBYBeNlRoWB1W3HuOdUsXxZNA,2664
|
|
56
|
+
maidr-1.4.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
57
|
+
maidr-1.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|