plotnine 0.15.0a1__py3-none-any.whl → 0.15.0a3__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.
- plotnine/_mpl/layout_manager/_layout_items.py +85 -23
- plotnine/_mpl/layout_manager/_layout_tree.py +16 -6
- plotnine/_mpl/layout_manager/_spaces.py +5 -5
- plotnine/_mpl/patches.py +70 -34
- plotnine/_mpl/text.py +150 -63
- plotnine/_mpl/utils.py +1 -1
- plotnine/_utils/__init__.py +30 -2
- plotnine/doctools.py +1 -1
- plotnine/facets/strips.py +17 -28
- plotnine/geoms/annotation_logticks.py +7 -8
- plotnine/geoms/annotation_stripes.py +6 -6
- plotnine/geoms/geom.py +20 -8
- plotnine/geoms/geom_abline.py +3 -2
- plotnine/geoms/geom_blank.py +0 -3
- plotnine/geoms/geom_boxplot.py +4 -4
- plotnine/geoms/geom_crossbar.py +3 -3
- plotnine/geoms/geom_dotplot.py +1 -1
- plotnine/geoms/geom_errorbar.py +2 -2
- plotnine/geoms/geom_errorbarh.py +2 -2
- plotnine/geoms/geom_hline.py +3 -2
- plotnine/geoms/geom_linerange.py +2 -2
- plotnine/geoms/geom_map.py +3 -3
- plotnine/geoms/geom_path.py +10 -11
- plotnine/geoms/geom_point.py +4 -5
- plotnine/geoms/geom_pointrange.py +3 -5
- plotnine/geoms/geom_polygon.py +2 -3
- plotnine/geoms/geom_raster.py +4 -5
- plotnine/geoms/geom_rect.py +3 -4
- plotnine/geoms/geom_ribbon.py +7 -7
- plotnine/geoms/geom_rug.py +1 -1
- plotnine/geoms/geom_segment.py +2 -2
- plotnine/geoms/geom_smooth.py +3 -3
- plotnine/geoms/geom_step.py +2 -2
- plotnine/geoms/geom_text.py +2 -3
- plotnine/geoms/geom_violin.py +4 -5
- plotnine/geoms/geom_vline.py +3 -2
- plotnine/guides/guides.py +1 -1
- plotnine/helpers.py +49 -0
- plotnine/iapi.py +28 -5
- plotnine/layer.py +18 -12
- plotnine/mapping/_eval_environment.py +1 -1
- plotnine/scales/scale_color.py +46 -14
- plotnine/scales/scale_continuous.py +5 -4
- plotnine/scales/scale_datetime.py +28 -14
- plotnine/scales/scale_discrete.py +2 -2
- plotnine/scales/scale_identity.py +10 -2
- plotnine/scales/scale_xy.py +2 -2
- plotnine/stats/binning.py +4 -1
- plotnine/stats/smoothers.py +19 -19
- plotnine/stats/stat.py +15 -25
- plotnine/stats/stat_bin.py +2 -5
- plotnine/stats/stat_bin_2d.py +7 -9
- plotnine/stats/stat_bindot.py +6 -11
- plotnine/stats/stat_boxplot.py +5 -5
- plotnine/stats/stat_count.py +5 -9
- plotnine/stats/stat_density.py +6 -9
- plotnine/stats/stat_density_2d.py +12 -9
- plotnine/stats/stat_ecdf.py +6 -5
- plotnine/stats/stat_ellipse.py +5 -6
- plotnine/stats/stat_function.py +6 -8
- plotnine/stats/stat_hull.py +2 -3
- plotnine/stats/stat_identity.py +1 -2
- plotnine/stats/stat_pointdensity.py +4 -7
- plotnine/stats/stat_qq.py +45 -20
- plotnine/stats/stat_qq_line.py +15 -11
- plotnine/stats/stat_quantile.py +6 -7
- plotnine/stats/stat_sina.py +12 -14
- plotnine/stats/stat_smooth.py +7 -10
- plotnine/stats/stat_sum.py +1 -2
- plotnine/stats/stat_summary.py +6 -9
- plotnine/stats/stat_summary_bin.py +10 -13
- plotnine/stats/stat_unique.py +1 -2
- plotnine/stats/stat_ydensity.py +7 -10
- plotnine/themes/elements/__init__.py +2 -1
- plotnine/themes/elements/margin.py +64 -1
- plotnine/themes/theme_gray.py +5 -3
- plotnine/themes/theme_matplotlib.py +5 -4
- plotnine/themes/theme_seaborn.py +7 -4
- plotnine/themes/theme_void.py +11 -4
- plotnine/themes/themeable.py +2 -2
- plotnine/typing.py +2 -2
- {plotnine-0.15.0a1.dist-info → plotnine-0.15.0a3.dist-info}/METADATA +7 -4
- {plotnine-0.15.0a1.dist-info → plotnine-0.15.0a3.dist-info}/RECORD +86 -85
- {plotnine-0.15.0a1.dist-info → plotnine-0.15.0a3.dist-info}/WHEEL +1 -1
- {plotnine-0.15.0a1.dist-info → plotnine-0.15.0a3.dist-info}/licenses/LICENSE +0 -0
- {plotnine-0.15.0a1.dist-info → plotnine-0.15.0a3.dist-info}/top_level.txt +0 -0
plotnine/stats/stat_smooth.py
CHANGED
|
@@ -37,7 +37,7 @@ class stat_smooth(stat):
|
|
|
37
37
|
If a `callable` is passed, it must have the signature:
|
|
38
38
|
|
|
39
39
|
```python
|
|
40
|
-
def my_smoother(data, xseq,
|
|
40
|
+
def my_smoother(data, xseq, params):
|
|
41
41
|
# * data - has the x and y values for the model
|
|
42
42
|
# * xseq - x values to be predicted
|
|
43
43
|
# * params - stat parameters
|
|
@@ -163,7 +163,7 @@ class stat_smooth(stat):
|
|
|
163
163
|
return data
|
|
164
164
|
|
|
165
165
|
def setup_params(self, data):
|
|
166
|
-
params = self.params
|
|
166
|
+
params = self.params
|
|
167
167
|
# Use loess/lowess for small datasets
|
|
168
168
|
# and glm for large
|
|
169
169
|
if params["method"] == "auto":
|
|
@@ -202,12 +202,9 @@ class stat_smooth(stat):
|
|
|
202
202
|
)
|
|
203
203
|
params["environment"] = self.environment
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
@classmethod
|
|
208
|
-
def compute_group(cls, data, scales, **params):
|
|
205
|
+
def compute_group(self, data, scales):
|
|
209
206
|
data = data.sort_values("x")
|
|
210
|
-
n = params["n"]
|
|
207
|
+
n = self.params["n"]
|
|
211
208
|
|
|
212
209
|
x_unique = data["x"].unique()
|
|
213
210
|
|
|
@@ -223,15 +220,15 @@ class stat_smooth(stat):
|
|
|
223
220
|
return pd.DataFrame()
|
|
224
221
|
|
|
225
222
|
if data["x"].dtype.kind == "i":
|
|
226
|
-
if params["fullrange"]:
|
|
223
|
+
if self.params["fullrange"]:
|
|
227
224
|
xseq = scales.x.dimension()
|
|
228
225
|
else:
|
|
229
226
|
xseq = np.sort(x_unique)
|
|
230
227
|
else:
|
|
231
|
-
if params["fullrange"]:
|
|
228
|
+
if self.params["fullrange"]:
|
|
232
229
|
rangee = scales.x.dimension()
|
|
233
230
|
else:
|
|
234
231
|
rangee = [data["x"].min(), data["x"].max()]
|
|
235
232
|
xseq = np.linspace(rangee[0], rangee[1], n)
|
|
236
233
|
|
|
237
|
-
return predictdf(data, xseq,
|
|
234
|
+
return predictdf(data, xseq, self.params)
|
plotnine/stats/stat_sum.py
CHANGED
|
@@ -35,8 +35,7 @@ class stat_sum(stat):
|
|
|
35
35
|
DEFAULT_AES = {"size": after_stat("n"), "weight": 1}
|
|
36
36
|
CREATES = {"n", "prop"}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
def compute_panel(cls, data, scales, **params):
|
|
38
|
+
def compute_panel(self, data, scales):
|
|
40
39
|
if "weight" not in data:
|
|
41
40
|
data["weight"] = 1
|
|
42
41
|
|
plotnine/stats/stat_summary.py
CHANGED
|
@@ -299,16 +299,13 @@ class stat_summary(stat):
|
|
|
299
299
|
|
|
300
300
|
self.params["fun_args"]["random_state"] = random_state
|
|
301
301
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
@classmethod
|
|
305
|
-
def compute_panel(cls, data, scales, **params):
|
|
302
|
+
def compute_panel(self, data, scales):
|
|
306
303
|
func = make_summary_fun(
|
|
307
|
-
params["fun_data"],
|
|
308
|
-
params["fun_y"],
|
|
309
|
-
params["fun_ymin"],
|
|
310
|
-
params["fun_ymax"],
|
|
311
|
-
params["fun_args"],
|
|
304
|
+
self.params["fun_data"],
|
|
305
|
+
self.params["fun_y"],
|
|
306
|
+
self.params["fun_ymin"],
|
|
307
|
+
self.params["fun_ymax"],
|
|
308
|
+
self.params["fun_args"],
|
|
312
309
|
)
|
|
313
310
|
|
|
314
311
|
# break a dataframe into pieces, summarise each piece,
|
|
@@ -123,21 +123,18 @@ class stat_summary_bin(stat):
|
|
|
123
123
|
|
|
124
124
|
self.params["fun_args"]["random_state"] = random_state
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
breaks = params["breaks"]
|
|
132
|
-
binwidth = params["binwidth"]
|
|
133
|
-
boundary = params["boundary"]
|
|
126
|
+
def compute_group(self, data, scales):
|
|
127
|
+
bins = self.params["bins"]
|
|
128
|
+
breaks = self.params["breaks"]
|
|
129
|
+
binwidth = self.params["binwidth"]
|
|
130
|
+
boundary = self.params["boundary"]
|
|
134
131
|
|
|
135
132
|
func = make_summary_fun(
|
|
136
|
-
params["fun_data"],
|
|
137
|
-
params["fun_y"],
|
|
138
|
-
params["fun_ymin"],
|
|
139
|
-
params["fun_ymax"],
|
|
140
|
-
params["fun_args"],
|
|
133
|
+
self.params["fun_data"],
|
|
134
|
+
self.params["fun_y"],
|
|
135
|
+
self.params["fun_ymin"],
|
|
136
|
+
self.params["fun_ymax"],
|
|
137
|
+
self.params["fun_args"],
|
|
141
138
|
)
|
|
142
139
|
|
|
143
140
|
breaks = fuzzybreaks(scales.x, breaks, boundary, binwidth, bins)
|
plotnine/stats/stat_unique.py
CHANGED
plotnine/stats/stat_ydensity.py
CHANGED
|
@@ -109,7 +109,7 @@ class stat_ydensity(stat):
|
|
|
109
109
|
return data
|
|
110
110
|
|
|
111
111
|
def setup_params(self, data):
|
|
112
|
-
params = self.params
|
|
112
|
+
params = self.params
|
|
113
113
|
|
|
114
114
|
valid_scale = ("area", "count", "width")
|
|
115
115
|
if params["scale"] not in valid_scale:
|
|
@@ -141,11 +141,9 @@ class stat_ydensity(stat):
|
|
|
141
141
|
for key in missing_params:
|
|
142
142
|
params[key] = stat_density.DEFAULT_PARAMS[key]
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def compute_panel(cls, data, scales, **params):
|
|
148
|
-
data = super(cls, cls).compute_panel(data, scales, **params)
|
|
144
|
+
def compute_panel(self, data, scales):
|
|
145
|
+
params = self.params
|
|
146
|
+
data = super().compute_panel(data, scales)
|
|
149
147
|
|
|
150
148
|
if not len(data):
|
|
151
149
|
return data
|
|
@@ -167,20 +165,19 @@ class stat_ydensity(stat):
|
|
|
167
165
|
|
|
168
166
|
return data
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
def compute_group(cls, data, scales, **params):
|
|
168
|
+
def compute_group(self, data, scales):
|
|
172
169
|
n = len(data)
|
|
173
170
|
if n == 0:
|
|
174
171
|
return pd.DataFrame()
|
|
175
172
|
|
|
176
173
|
weight = data.get("weight")
|
|
177
174
|
|
|
178
|
-
if params["trim"]:
|
|
175
|
+
if self.params["trim"]:
|
|
179
176
|
range_y = data["y"].min(), data["y"].max()
|
|
180
177
|
else:
|
|
181
178
|
range_y = scales.y.dimension()
|
|
182
179
|
|
|
183
|
-
dens = compute_density(data["y"], weight, range_y,
|
|
180
|
+
dens = compute_density(data["y"], weight, range_y, self.params)
|
|
184
181
|
|
|
185
182
|
if not len(dens):
|
|
186
183
|
return dens
|
|
@@ -2,7 +2,7 @@ from .element_blank import element_blank
|
|
|
2
2
|
from .element_line import element_line
|
|
3
3
|
from .element_rect import element_rect
|
|
4
4
|
from .element_text import element_text
|
|
5
|
-
from .margin import margin
|
|
5
|
+
from .margin import margin, margin_auto
|
|
6
6
|
|
|
7
7
|
__all__ = (
|
|
8
8
|
"element_blank",
|
|
@@ -10,4 +10,5 @@ __all__ = (
|
|
|
10
10
|
"element_rect",
|
|
11
11
|
"element_text",
|
|
12
12
|
"margin",
|
|
13
|
+
"margin_auto",
|
|
13
14
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Margin
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
@@ -17,17 +17,55 @@ if TYPE_CHECKING:
|
|
|
17
17
|
|
|
18
18
|
@dataclass
|
|
19
19
|
class margin:
|
|
20
|
+
"""
|
|
21
|
+
Margin
|
|
22
|
+
"""
|
|
23
|
+
|
|
20
24
|
t: float = 0
|
|
25
|
+
"""
|
|
26
|
+
Top margin
|
|
27
|
+
"""
|
|
28
|
+
|
|
21
29
|
r: float = 0
|
|
30
|
+
"""
|
|
31
|
+
Right margin
|
|
32
|
+
"""
|
|
33
|
+
|
|
22
34
|
b: float = 0
|
|
35
|
+
"""
|
|
36
|
+
Bottom margin
|
|
37
|
+
"""
|
|
38
|
+
|
|
23
39
|
l: float = 0
|
|
40
|
+
"""
|
|
41
|
+
Left Margin
|
|
42
|
+
"""
|
|
43
|
+
|
|
24
44
|
unit: Literal["pt", "in", "lines", "fig"] = "pt"
|
|
45
|
+
"""
|
|
46
|
+
The units (coordinate space) of the values
|
|
47
|
+
"""
|
|
25
48
|
|
|
26
49
|
# These are set by the themeable when it is applied
|
|
27
50
|
fontsize: float = field(init=False, default=0)
|
|
51
|
+
"""
|
|
52
|
+
Font size of text that this margin applies to
|
|
53
|
+
"""
|
|
54
|
+
|
|
28
55
|
figure_size: tuple[float, float] = field(init=False, default=(0, 0))
|
|
56
|
+
"""
|
|
57
|
+
Size of the figure in inches
|
|
58
|
+
"""
|
|
29
59
|
|
|
30
60
|
def setup(self, theme: theme, themeable_name: str):
|
|
61
|
+
"""
|
|
62
|
+
Setup the margin to be used in the layout
|
|
63
|
+
|
|
64
|
+
For the margin's values to be useful, we need to be able to
|
|
65
|
+
convert them to different units as is required. Here we get
|
|
66
|
+
all the parameters that we shall need to do the conversions.
|
|
67
|
+
"""
|
|
68
|
+
self.themeable_name = themeable_name
|
|
31
69
|
self.fontsize = theme.getp((themeable_name, "size"), 11)
|
|
32
70
|
self.figure_size = theme.getp("figure_size")
|
|
33
71
|
|
|
@@ -35,6 +73,8 @@ class margin:
|
|
|
35
73
|
def pt(self) -> margin:
|
|
36
74
|
"""
|
|
37
75
|
Return margin in points
|
|
76
|
+
|
|
77
|
+
These are the units of the display coordinate system
|
|
38
78
|
"""
|
|
39
79
|
return self.to("pt")
|
|
40
80
|
|
|
@@ -42,6 +82,8 @@ class margin:
|
|
|
42
82
|
def inch(self) -> margin:
|
|
43
83
|
"""
|
|
44
84
|
Return margin in inches
|
|
85
|
+
|
|
86
|
+
These are the units of the figure-inches coordinate system
|
|
45
87
|
"""
|
|
46
88
|
return self.to("in")
|
|
47
89
|
|
|
@@ -56,6 +98,8 @@ class margin:
|
|
|
56
98
|
def fig(self) -> margin:
|
|
57
99
|
"""
|
|
58
100
|
Return margin in figure units
|
|
101
|
+
|
|
102
|
+
These are the units of the figure coordinate system
|
|
59
103
|
"""
|
|
60
104
|
return self.to("fig")
|
|
61
105
|
|
|
@@ -102,3 +146,22 @@ class margin:
|
|
|
102
146
|
}
|
|
103
147
|
|
|
104
148
|
return functions[conversion](value)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def margin_auto(
|
|
152
|
+
t: float = 0.0,
|
|
153
|
+
r: float | None = None,
|
|
154
|
+
b: float | None = None,
|
|
155
|
+
l: float | None = None,
|
|
156
|
+
unit: Literal["pt", "in", "lines", "fig"] = "pt",
|
|
157
|
+
) -> margin:
|
|
158
|
+
"""
|
|
159
|
+
Create margin with minimal arguments
|
|
160
|
+
"""
|
|
161
|
+
if r is None:
|
|
162
|
+
r = t
|
|
163
|
+
if b is None:
|
|
164
|
+
b = t
|
|
165
|
+
if l is None:
|
|
166
|
+
l = r
|
|
167
|
+
return margin(t, r, b, l, unit)
|
plotnine/themes/theme_gray.py
CHANGED
|
@@ -6,6 +6,7 @@ from .elements import (
|
|
|
6
6
|
element_rect,
|
|
7
7
|
element_text,
|
|
8
8
|
margin,
|
|
9
|
+
margin_auto,
|
|
9
10
|
)
|
|
10
11
|
from .theme import theme
|
|
11
12
|
|
|
@@ -27,6 +28,7 @@ class theme_gray(theme):
|
|
|
27
28
|
|
|
28
29
|
def __init__(self, base_size=11, base_family=None):
|
|
29
30
|
base_family = base_family or get_option("base_family")
|
|
31
|
+
half_line = base_size / 2
|
|
30
32
|
quarter_line = base_size / 4
|
|
31
33
|
fifth_line = base_size / 5
|
|
32
34
|
eighth_line = base_size / 8
|
|
@@ -88,7 +90,7 @@ class theme_gray(theme):
|
|
|
88
90
|
legend_spacing=10, # points
|
|
89
91
|
legend_text=element_text(
|
|
90
92
|
size=base_size * 0.8,
|
|
91
|
-
margin=
|
|
93
|
+
margin=margin_auto(m / 1.5, unit="fig"),
|
|
92
94
|
),
|
|
93
95
|
legend_ticks=element_line(color="#CCCCCC", size=1),
|
|
94
96
|
legend_title=element_text(
|
|
@@ -135,8 +137,8 @@ class theme_gray(theme):
|
|
|
135
137
|
strip_text=element_text(
|
|
136
138
|
color="#1A1A1A",
|
|
137
139
|
size=base_size * 0.8,
|
|
138
|
-
linespacing=1.
|
|
139
|
-
margin=
|
|
140
|
+
linespacing=1.5,
|
|
141
|
+
margin=margin_auto(half_line * 0.8),
|
|
140
142
|
),
|
|
141
143
|
strip_text_y=element_text(rotation=-90),
|
|
142
144
|
complete=True,
|
|
@@ -5,6 +5,7 @@ from .elements import (
|
|
|
5
5
|
element_rect,
|
|
6
6
|
element_text,
|
|
7
7
|
margin,
|
|
8
|
+
margin_auto,
|
|
8
9
|
)
|
|
9
10
|
from .theme import theme
|
|
10
11
|
|
|
@@ -33,6 +34,7 @@ class theme_matplotlib(theme):
|
|
|
33
34
|
m = get_option("base_margin")
|
|
34
35
|
base_size = mpl.rcParams.get("font.size", 11)
|
|
35
36
|
linewidth = mpl.rcParams.get("grid.linewidth", 0.8)
|
|
37
|
+
half_line = base_size / 2
|
|
36
38
|
|
|
37
39
|
super().__init__(
|
|
38
40
|
line=element_line(size=linewidth),
|
|
@@ -68,9 +70,7 @@ class theme_matplotlib(theme):
|
|
|
68
70
|
legend_margin=0,
|
|
69
71
|
legend_position="right",
|
|
70
72
|
legend_spacing=10,
|
|
71
|
-
legend_text=element_text(
|
|
72
|
-
margin=margin(m / 2, m / 2, m / 2, m / 2, "fig")
|
|
73
|
-
),
|
|
73
|
+
legend_text=element_text(margin=margin_auto(m / 2, unit="fig")),
|
|
74
74
|
legend_ticks=element_line(color="black"),
|
|
75
75
|
legend_title=element_text(
|
|
76
76
|
ha="left",
|
|
@@ -111,7 +111,8 @@ class theme_matplotlib(theme):
|
|
|
111
111
|
fill="#D9D9D9", color="black", size=linewidth
|
|
112
112
|
),
|
|
113
113
|
strip_text=element_text(
|
|
114
|
-
|
|
114
|
+
linespacing=1.5,
|
|
115
|
+
margin=margin_auto(half_line * 0.8),
|
|
115
116
|
),
|
|
116
117
|
strip_text_y=element_text(rotation=-90),
|
|
117
118
|
complete=True,
|
plotnine/themes/theme_seaborn.py
CHANGED
|
@@ -5,6 +5,7 @@ from .elements import (
|
|
|
5
5
|
element_rect,
|
|
6
6
|
element_text,
|
|
7
7
|
margin,
|
|
8
|
+
margin_auto,
|
|
8
9
|
)
|
|
9
10
|
from .theme import theme
|
|
10
11
|
|
|
@@ -20,7 +21,7 @@ class theme_seaborn(theme):
|
|
|
20
21
|
|
|
21
22
|
Parameters
|
|
22
23
|
----------
|
|
23
|
-
style: "
|
|
24
|
+
style: "white", "dark", "whitegrid", "darkgrid", "ticks"
|
|
24
25
|
Style of axis background.
|
|
25
26
|
context: "notebook", "talk", "paper", "poster"]``
|
|
26
27
|
Intended context for resulting figures.
|
|
@@ -83,13 +84,15 @@ class theme_seaborn(theme):
|
|
|
83
84
|
legend_position="right",
|
|
84
85
|
legend_spacing=10, # points
|
|
85
86
|
legend_text=element_text(
|
|
86
|
-
|
|
87
|
+
size=base_size * 0.8,
|
|
88
|
+
margin=margin_auto(m / 1.5, unit="fig"),
|
|
87
89
|
),
|
|
88
90
|
legend_ticks=element_line(color="#CCCCCC", size=1),
|
|
89
91
|
legend_title=element_text(
|
|
90
92
|
margin=margin(t=m, l=m * 2, b=m / 2, r=m * 2, unit="fig")
|
|
91
93
|
),
|
|
92
94
|
panel_spacing=m,
|
|
95
|
+
panel_background=element_rect(fill=rcparams["axes.facecolor"]),
|
|
93
96
|
plot_caption=element_text(
|
|
94
97
|
size=base_size * 0.8,
|
|
95
98
|
ha="right",
|
|
@@ -123,8 +126,8 @@ class theme_seaborn(theme):
|
|
|
123
126
|
strip_background=element_rect(color="none", fill="#D1CDDF"),
|
|
124
127
|
strip_text=element_text(
|
|
125
128
|
size=base_size * 0.8,
|
|
126
|
-
linespacing=1.
|
|
127
|
-
margin=
|
|
129
|
+
linespacing=1.5,
|
|
130
|
+
margin=margin_auto(half_line * 0.8),
|
|
128
131
|
),
|
|
129
132
|
strip_text_y=element_text(rotation=-90),
|
|
130
133
|
complete=True,
|
plotnine/themes/theme_void.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
from ..options import get_option
|
|
2
|
-
from .elements import
|
|
2
|
+
from .elements import (
|
|
3
|
+
element_blank,
|
|
4
|
+
element_line,
|
|
5
|
+
element_text,
|
|
6
|
+
margin,
|
|
7
|
+
margin_auto,
|
|
8
|
+
)
|
|
3
9
|
from .theme import theme
|
|
4
10
|
|
|
5
11
|
|
|
@@ -19,6 +25,7 @@ class theme_void(theme):
|
|
|
19
25
|
|
|
20
26
|
def __init__(self, base_size=11, base_family=None):
|
|
21
27
|
base_family = base_family or get_option("base_family")
|
|
28
|
+
half_line = base_size / 2
|
|
22
29
|
m = get_option("base_margin")
|
|
23
30
|
# Use only inherited elements and make everything blank
|
|
24
31
|
theme.__init__(
|
|
@@ -54,7 +61,7 @@ class theme_void(theme):
|
|
|
54
61
|
legend_spacing=10,
|
|
55
62
|
legend_text=element_text(
|
|
56
63
|
size=base_size * 0.8,
|
|
57
|
-
margin=
|
|
64
|
+
margin=margin_auto(m / 1.5, unit="fig"),
|
|
58
65
|
),
|
|
59
66
|
legend_ticks=element_line(color="#CCCCCC", size=1),
|
|
60
67
|
legend_title=element_text(
|
|
@@ -94,8 +101,8 @@ class theme_void(theme):
|
|
|
94
101
|
strip_text=element_text(
|
|
95
102
|
color="#1A1A1A",
|
|
96
103
|
size=base_size * 0.8,
|
|
97
|
-
linespacing=1.
|
|
98
|
-
margin=
|
|
104
|
+
linespacing=1.5,
|
|
105
|
+
margin=margin_auto(half_line * 0.8),
|
|
99
106
|
),
|
|
100
107
|
complete=True,
|
|
101
108
|
)
|
plotnine/themes/themeable.py
CHANGED
|
@@ -852,7 +852,7 @@ class strip_text_x(MixinSequenceOfValues):
|
|
|
852
852
|
theme_element : element_text
|
|
853
853
|
"""
|
|
854
854
|
|
|
855
|
-
_omit = ["margin", "ha"]
|
|
855
|
+
_omit = ["margin", "ha", "va"]
|
|
856
856
|
|
|
857
857
|
def apply_figure(self, figure: Figure, targets: ThemeTargets):
|
|
858
858
|
super().apply_figure(figure, targets)
|
|
@@ -875,7 +875,7 @@ class strip_text_y(MixinSequenceOfValues):
|
|
|
875
875
|
theme_element : element_text
|
|
876
876
|
"""
|
|
877
877
|
|
|
878
|
-
_omit = ["margin", "va"]
|
|
878
|
+
_omit = ["margin", "ha", "va"]
|
|
879
879
|
|
|
880
880
|
def apply_figure(self, figure: Figure, targets: ThemeTargets):
|
|
881
881
|
super().apply_figure(figure, targets)
|
plotnine/typing.py
CHANGED
|
@@ -80,7 +80,7 @@ FacetSpaceRatios: TypeAlias = dict[Literal["x", "y"], Sequence[float]]
|
|
|
80
80
|
|
|
81
81
|
StripPosition: TypeAlias = Literal["top", "right"]
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
# Scales
|
|
84
84
|
|
|
85
85
|
# Name names of scaled aesthetics
|
|
86
86
|
ScaledAestheticsName: TypeAlias = Literal[
|
|
@@ -110,7 +110,7 @@ ScaledAestheticsName: TypeAlias = Literal[
|
|
|
110
110
|
"upper",
|
|
111
111
|
]
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
# Coords
|
|
114
114
|
CoordRange: TypeAlias = tuple[float, float]
|
|
115
115
|
|
|
116
116
|
# Guide
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotnine
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.0a3
|
|
4
4
|
Summary: A Grammar of Graphics for Python
|
|
5
5
|
Author-email: Hassan Kibirige <has2k1@gmail.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -46,7 +46,7 @@ Description-Content-Type: text/markdown
|
|
|
46
46
|
License-File: LICENSE
|
|
47
47
|
Requires-Dist: matplotlib>=3.8.0
|
|
48
48
|
Requires-Dist: pandas>=2.2.0
|
|
49
|
-
Requires-Dist: mizani~=0.
|
|
49
|
+
Requires-Dist: mizani~=0.14.0
|
|
50
50
|
Requires-Dist: numpy>=1.23.5
|
|
51
51
|
Requires-Dist: scipy>=1.8.0
|
|
52
52
|
Requires-Dist: statsmodels>=0.14.0
|
|
@@ -60,8 +60,11 @@ Requires-Dist: plotnine[dev]; extra == "all"
|
|
|
60
60
|
Provides-Extra: extra
|
|
61
61
|
Requires-Dist: adjustText>=1.2.0; extra == "extra"
|
|
62
62
|
Requires-Dist: geopandas>=1.0.0; extra == "extra"
|
|
63
|
-
Requires-Dist:
|
|
63
|
+
Requires-Dist: geodatasets>=2024.8.0; extra == "extra"
|
|
64
|
+
Requires-Dist: scikit-learn>=1.3.0; extra == "extra"
|
|
64
65
|
Requires-Dist: scikit-misc>=0.5.1; extra == "extra"
|
|
66
|
+
Requires-Dist: polars>=1.24.0; extra == "extra"
|
|
67
|
+
Requires-Dist: pyarrow>=19.0.1; extra == "extra"
|
|
65
68
|
Provides-Extra: doc
|
|
66
69
|
Requires-Dist: jupyter; extra == "doc"
|
|
67
70
|
Requires-Dist: click; extra == "doc"
|
|
@@ -79,7 +82,7 @@ Requires-Dist: twine; extra == "dev"
|
|
|
79
82
|
Requires-Dist: plotnine[typing]; extra == "dev"
|
|
80
83
|
Requires-Dist: pre-commit; extra == "dev"
|
|
81
84
|
Provides-Extra: typing
|
|
82
|
-
Requires-Dist: pyright==1.1.
|
|
85
|
+
Requires-Dist: pyright==1.1.402; extra == "typing"
|
|
83
86
|
Requires-Dist: ipython; extra == "typing"
|
|
84
87
|
Requires-Dist: pandas-stubs; extra == "typing"
|
|
85
88
|
Dynamic: license-file
|