1
1
from typing import Optional , Iterable , Type , Union
2
2
from matplotlib .artist import Artist
3
3
from matplotlib .axes import Axes
4
- from matplotview ._view_axes import view_wrapper , ViewSpecification
4
+ from matplotview ._view_axes import view_wrapper , ViewSpecification , DEFAULT_RENDER_DEPTH
5
+ from matplotview ._docs import dynamic_doc_string , get_interpolation_list_str
5
6
6
7
7
8
__all__ = ["view" , "inset_zoom_axes" , "ViewSpecification" ]
8
9
9
10
11
+ @dynamic_doc_string (render_depth = DEFAULT_RENDER_DEPTH , interp_list = get_interpolation_list_str ())
10
12
def view (
11
13
axes : Axes ,
12
14
axes_to_view : Axes ,
@@ -28,29 +30,31 @@ def view(
28
30
The axes to display the contents of in the first axes, the 'viewed'
29
31
axes.
30
32
31
- image_interpolation: string, default of "nearest"
33
+ image_interpolation: string, default of '{image_interpolation}'
32
34
The image interpolation method to use when displaying scaled images
33
- from the axes being viewed. Defaults to "nearest". Supported options
34
- are 'antialiased', 'nearest', 'bilinear', 'bicubic', 'spline16',
35
- 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
36
- 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos',
37
- or 'none'
35
+ from the axes being viewed. Defaults to '{image_interpolation}'. Supported options
36
+ are {interp_list}.
38
37
39
38
render_depth: optional int, positive, defaults to None
40
39
The number of recursive draws allowed for this view, this can happen
41
40
if the view is a child of the axes (such as an inset axes) or if
42
41
two views point at each other. If None, uses the default render depth
43
- of 5 , unless the axes passed is already a view axes, in which case the
42
+ of {render_depth} , unless the axes passed is already a view axes, in which case the
44
43
render depth the view already has will be used.
45
44
46
45
filter_set: Iterable[Union[Type[Artist], Artist]] or None
47
46
An optional filter set, which can be used to select what artists
48
47
are drawn by the view. Any artists or artist types in the set are not
49
48
drawn.
50
49
51
- scale_lines: bool, defaults to True
50
+ scale_lines: bool, defaults to {scale_lines}
52
51
Specifies if lines should be drawn thicker based on scaling in the
53
52
view.
53
+
54
+ Returns
55
+ -------
56
+ axes
57
+ The modified `~.axes.Axes` instance which is now a view.
54
58
"""
55
59
view_obj = view_wrapper (type (axes )).from_axes (axes , render_depth )
56
60
view_obj .view_specifications [axes_to_view ] = ViewSpecification (
@@ -61,6 +65,7 @@ def view(
61
65
return view_obj
62
66
63
67
68
+ @dynamic_doc_string (render_depth = DEFAULT_RENDER_DEPTH , interp_list = get_interpolation_list_str ())
64
69
def inset_zoom_axes (
65
70
axes : Axes ,
66
71
bounds : Iterable ,
@@ -69,7 +74,7 @@ def inset_zoom_axes(
69
74
render_depth : Optional [int ] = None ,
70
75
filter_set : Optional [Iterable [Union [Type [Artist ], Artist ]]] = None ,
71
76
scale_lines : bool = True ,
72
- transform = None ,
77
+ transform = None ,
73
78
zorder : int = 5 ,
74
79
** kwargs
75
80
) -> Axes :
@@ -90,31 +95,28 @@ def inset_zoom_axes(
90
95
Axes-relative coordinates.
91
96
92
97
zorder: number
93
- Defaults to 5 (same as `.Axes.legend`). Adjust higher or lower
98
+ Defaults to {zorder} (same as `.Axes.legend`). Adjust higher or lower
94
99
to change whether it is above or below data plotted on the
95
100
parent Axes.
96
101
97
102
image_interpolation: string
98
- Supported options are 'antialiased', 'nearest', 'bilinear',
99
- 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
100
- 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
101
- 'sinc', 'lanczos', or 'none'. The default value is 'nearest'. This
103
+ Supported options are {interp_list}. The default value is '{image_interpolation}'. This
102
104
determines the interpolation used when attempting to render a
103
105
zoomed version of an image.
104
106
105
107
render_depth: optional int, positive, defaults to None
106
108
The number of recursive draws allowed for this view, this can happen
107
109
if the view is a child of the axes (such as an inset axes) or if
108
110
two views point at each other. If None, uses the default render depth
109
- of 5 , unless the axes passed is already a view axes, in which case the
111
+ of {render_depth} , unless the axes passed is already a view axes, in which case the
110
112
render depth the view already has will be used.
111
113
112
114
filter_set: Iterable[Union[Type[Artist], Artist]] or None
113
115
An optional filter set, which can be used to select what artists
114
116
are drawn by the view. Any artists or artist types in the set are not
115
117
drawn.
116
118
117
- scale_lines: bool, defaults to True
119
+ scale_lines: bool, defaults to {scale_lines}
118
120
Specifies if lines should be drawn thicker based on scaling in the
119
121
view.
120
122
0 commit comments