ggplot2-python 4.0.2.9000__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.
- ggplot2_py/__init__.py +852 -0
- ggplot2_py/_compat.py +475 -0
- ggplot2_py/_plugins.py +129 -0
- ggplot2_py/_utils.py +544 -0
- ggplot2_py/aes.py +586 -0
- ggplot2_py/annotation.py +540 -0
- ggplot2_py/coord.py +2108 -0
- ggplot2_py/coords/__init__.py +49 -0
- ggplot2_py/datasets.py +265 -0
- ggplot2_py/draw_key.py +454 -0
- ggplot2_py/facet.py +1456 -0
- ggplot2_py/fortify.py +95 -0
- ggplot2_py/geom.py +4516 -0
- ggplot2_py/geoms/__init__.py +12 -0
- ggplot2_py/ggproto.py +279 -0
- ggplot2_py/guide.py +2925 -0
- ggplot2_py/guide_axis.py +615 -0
- ggplot2_py/guide_colourbar.py +657 -0
- ggplot2_py/guide_legend.py +1061 -0
- ggplot2_py/guides/__init__.py +8 -0
- ggplot2_py/labeller.py +296 -0
- ggplot2_py/labels.py +309 -0
- ggplot2_py/layer.py +954 -0
- ggplot2_py/layout.py +754 -0
- ggplot2_py/limits.py +314 -0
- ggplot2_py/plot.py +1401 -0
- ggplot2_py/plot_render.py +866 -0
- ggplot2_py/position.py +1269 -0
- ggplot2_py/protocols.py +171 -0
- ggplot2_py/py.typed +0 -0
- ggplot2_py/qplot.py +233 -0
- ggplot2_py/resources/diamonds.csv +53941 -0
- ggplot2_py/resources/economics.csv +575 -0
- ggplot2_py/resources/economics_long.csv +2871 -0
- ggplot2_py/resources/faithfuld.csv +5626 -0
- ggplot2_py/resources/luv_colours.csv +658 -0
- ggplot2_py/resources/midwest.csv +438 -0
- ggplot2_py/resources/mpg.csv +235 -0
- ggplot2_py/resources/msleep.csv +84 -0
- ggplot2_py/resources/presidential.csv +13 -0
- ggplot2_py/resources/seals.csv +1156 -0
- ggplot2_py/resources/txhousing.csv +8603 -0
- ggplot2_py/save.py +316 -0
- ggplot2_py/scale.py +2727 -0
- ggplot2_py/scales/__init__.py +4252 -0
- ggplot2_py/stat.py +6071 -0
- ggplot2_py/stats/__init__.py +9 -0
- ggplot2_py/theme.py +490 -0
- ggplot2_py/theme_defaults.py +1350 -0
- ggplot2_py/theme_elements.py +2052 -0
- ggplot2_python-4.0.2.9000.dist-info/METADATA +179 -0
- ggplot2_python-4.0.2.9000.dist-info/RECORD +54 -0
- ggplot2_python-4.0.2.9000.dist-info/WHEEL +4 -0
- ggplot2_python-4.0.2.9000.dist-info/licenses/LICENSE +3 -0
ggplot2_py/__init__.py
ADDED
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ggplot2_py — Python port of the R ggplot2 package.
|
|
3
|
+
|
|
4
|
+
A grammar of graphics implementation for Python, providing a layered
|
|
5
|
+
approach to creating statistical visualizations.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
__version__ = "4.0.2.9000"
|
|
11
|
+
__r_commit__ = "c02c05a"
|
|
12
|
+
|
|
13
|
+
# ---------------------------------------------------------------------------
|
|
14
|
+
# Core infrastructure
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
from ggplot2_py._compat import (
|
|
17
|
+
Waiver,
|
|
18
|
+
waiver,
|
|
19
|
+
is_waiver,
|
|
20
|
+
)
|
|
21
|
+
from ggplot2_py.ggproto import (
|
|
22
|
+
GGProto,
|
|
23
|
+
ggproto,
|
|
24
|
+
ggproto_parent,
|
|
25
|
+
is_ggproto,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
# Aesthetics
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
from ggplot2_py.aes import (
|
|
32
|
+
aes,
|
|
33
|
+
after_stat,
|
|
34
|
+
after_scale,
|
|
35
|
+
stage,
|
|
36
|
+
vars,
|
|
37
|
+
is_mapping,
|
|
38
|
+
standardise_aes_names,
|
|
39
|
+
Mapping,
|
|
40
|
+
eval_aes_value,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# ---------------------------------------------------------------------------
|
|
44
|
+
# Datasets
|
|
45
|
+
# ---------------------------------------------------------------------------
|
|
46
|
+
from ggplot2_py import datasets
|
|
47
|
+
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
# Layer
|
|
50
|
+
# ---------------------------------------------------------------------------
|
|
51
|
+
from ggplot2_py.layer import Layer, layer, is_layer
|
|
52
|
+
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
# Plot core
|
|
55
|
+
# ---------------------------------------------------------------------------
|
|
56
|
+
from ggplot2_py.plot import (
|
|
57
|
+
GGPlot,
|
|
58
|
+
ggplot,
|
|
59
|
+
is_ggplot,
|
|
60
|
+
ggplot_build,
|
|
61
|
+
ggplot_gtable,
|
|
62
|
+
ggplotGrob,
|
|
63
|
+
ggplot_add,
|
|
64
|
+
add_gg,
|
|
65
|
+
get_last_plot,
|
|
66
|
+
set_last_plot,
|
|
67
|
+
last_plot,
|
|
68
|
+
get_alt_text,
|
|
69
|
+
update_ggplot,
|
|
70
|
+
update_labels,
|
|
71
|
+
by_layer,
|
|
72
|
+
BuildStage,
|
|
73
|
+
ggplot_defaults,
|
|
74
|
+
get_layer_data,
|
|
75
|
+
get_layer_grob,
|
|
76
|
+
get_panel_scales,
|
|
77
|
+
get_guide_data,
|
|
78
|
+
get_strip_labels,
|
|
79
|
+
get_labs,
|
|
80
|
+
layer_data,
|
|
81
|
+
layer_grob,
|
|
82
|
+
layer_scales,
|
|
83
|
+
summarise_plot,
|
|
84
|
+
summarise_coord,
|
|
85
|
+
summarise_layers,
|
|
86
|
+
summarise_layout,
|
|
87
|
+
find_panel,
|
|
88
|
+
panel_rows,
|
|
89
|
+
panel_cols,
|
|
90
|
+
print_plot,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# ---------------------------------------------------------------------------
|
|
94
|
+
# Protocols (structural typing contracts — Python-exclusive)
|
|
95
|
+
# ---------------------------------------------------------------------------
|
|
96
|
+
from ggplot2_py.protocols import (
|
|
97
|
+
GeomProtocol,
|
|
98
|
+
StatProtocol,
|
|
99
|
+
ScaleProtocol,
|
|
100
|
+
CoordProtocol,
|
|
101
|
+
FacetProtocol,
|
|
102
|
+
PositionProtocol,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# ---------------------------------------------------------------------------
|
|
106
|
+
# Geoms
|
|
107
|
+
# ---------------------------------------------------------------------------
|
|
108
|
+
from ggplot2_py.geom import (
|
|
109
|
+
Geom,
|
|
110
|
+
GeomPoint,
|
|
111
|
+
GeomPath,
|
|
112
|
+
GeomLine,
|
|
113
|
+
GeomStep,
|
|
114
|
+
GeomBar,
|
|
115
|
+
GeomCol,
|
|
116
|
+
GeomRect,
|
|
117
|
+
GeomTile,
|
|
118
|
+
GeomRaster,
|
|
119
|
+
GeomText,
|
|
120
|
+
GeomLabel,
|
|
121
|
+
GeomBoxplot,
|
|
122
|
+
GeomViolin,
|
|
123
|
+
GeomDotplot,
|
|
124
|
+
GeomRibbon,
|
|
125
|
+
GeomArea,
|
|
126
|
+
GeomSmooth,
|
|
127
|
+
GeomPolygon,
|
|
128
|
+
GeomErrorbar,
|
|
129
|
+
GeomErrorbarh,
|
|
130
|
+
GeomCrossbar,
|
|
131
|
+
GeomLinerange,
|
|
132
|
+
GeomPointrange,
|
|
133
|
+
GeomSegment,
|
|
134
|
+
GeomCurve,
|
|
135
|
+
GeomSpoke,
|
|
136
|
+
GeomDensity,
|
|
137
|
+
GeomDensity2d,
|
|
138
|
+
GeomDensity2dFilled,
|
|
139
|
+
GeomContour,
|
|
140
|
+
GeomContourFilled,
|
|
141
|
+
GeomHex,
|
|
142
|
+
GeomBin2d,
|
|
143
|
+
GeomAbline,
|
|
144
|
+
GeomHline,
|
|
145
|
+
GeomVline,
|
|
146
|
+
GeomRug,
|
|
147
|
+
GeomBlank,
|
|
148
|
+
GeomFunction,
|
|
149
|
+
GeomFreqpoly,
|
|
150
|
+
GeomHistogram,
|
|
151
|
+
GeomCount,
|
|
152
|
+
GeomMap,
|
|
153
|
+
GeomQuantile,
|
|
154
|
+
GeomJitter,
|
|
155
|
+
GeomSf,
|
|
156
|
+
geom_point,
|
|
157
|
+
geom_path,
|
|
158
|
+
geom_line,
|
|
159
|
+
geom_step,
|
|
160
|
+
geom_bar,
|
|
161
|
+
geom_col,
|
|
162
|
+
geom_rect,
|
|
163
|
+
geom_tile,
|
|
164
|
+
geom_raster,
|
|
165
|
+
geom_text,
|
|
166
|
+
geom_label,
|
|
167
|
+
geom_boxplot,
|
|
168
|
+
geom_violin,
|
|
169
|
+
geom_dotplot,
|
|
170
|
+
geom_ribbon,
|
|
171
|
+
geom_area,
|
|
172
|
+
geom_smooth,
|
|
173
|
+
geom_polygon,
|
|
174
|
+
geom_errorbar,
|
|
175
|
+
geom_errorbarh,
|
|
176
|
+
geom_crossbar,
|
|
177
|
+
geom_linerange,
|
|
178
|
+
geom_pointrange,
|
|
179
|
+
geom_segment,
|
|
180
|
+
geom_curve,
|
|
181
|
+
geom_spoke,
|
|
182
|
+
geom_density,
|
|
183
|
+
geom_density2d,
|
|
184
|
+
geom_density2d_filled,
|
|
185
|
+
geom_density_2d,
|
|
186
|
+
geom_density_2d_filled,
|
|
187
|
+
geom_contour,
|
|
188
|
+
geom_contour_filled,
|
|
189
|
+
geom_hex,
|
|
190
|
+
geom_bin2d,
|
|
191
|
+
geom_bin_2d,
|
|
192
|
+
geom_abline,
|
|
193
|
+
geom_hline,
|
|
194
|
+
geom_vline,
|
|
195
|
+
geom_rug,
|
|
196
|
+
geom_blank,
|
|
197
|
+
geom_function,
|
|
198
|
+
geom_histogram,
|
|
199
|
+
geom_freqpoly,
|
|
200
|
+
geom_count,
|
|
201
|
+
geom_jitter,
|
|
202
|
+
geom_map,
|
|
203
|
+
geom_quantile,
|
|
204
|
+
geom_sf,
|
|
205
|
+
geom_sf_label,
|
|
206
|
+
geom_sf_text,
|
|
207
|
+
geom_qq,
|
|
208
|
+
geom_qq_line,
|
|
209
|
+
is_geom,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
# ---------------------------------------------------------------------------
|
|
213
|
+
# Stats
|
|
214
|
+
# ---------------------------------------------------------------------------
|
|
215
|
+
from ggplot2_py.stat import (
|
|
216
|
+
Stat,
|
|
217
|
+
StatIdentity,
|
|
218
|
+
StatBin,
|
|
219
|
+
StatCount,
|
|
220
|
+
StatDensity,
|
|
221
|
+
StatSmooth,
|
|
222
|
+
StatBoxplot,
|
|
223
|
+
StatSummary,
|
|
224
|
+
StatSummaryBin,
|
|
225
|
+
StatSummary2d,
|
|
226
|
+
StatSummaryHex,
|
|
227
|
+
StatFunction,
|
|
228
|
+
StatEcdf,
|
|
229
|
+
StatQq,
|
|
230
|
+
StatQqLine,
|
|
231
|
+
StatBin2d,
|
|
232
|
+
StatBinhex,
|
|
233
|
+
StatContour,
|
|
234
|
+
StatContourFilled,
|
|
235
|
+
StatDensity2d,
|
|
236
|
+
StatDensity2dFilled,
|
|
237
|
+
StatEllipse,
|
|
238
|
+
StatUnique,
|
|
239
|
+
StatSum,
|
|
240
|
+
StatYdensity,
|
|
241
|
+
StatBindot,
|
|
242
|
+
StatAlign,
|
|
243
|
+
StatConnect,
|
|
244
|
+
StatManual,
|
|
245
|
+
StatQuantile,
|
|
246
|
+
stat_identity,
|
|
247
|
+
stat_bin,
|
|
248
|
+
stat_count,
|
|
249
|
+
stat_density,
|
|
250
|
+
stat_smooth,
|
|
251
|
+
stat_boxplot,
|
|
252
|
+
stat_summary,
|
|
253
|
+
stat_summary_bin,
|
|
254
|
+
stat_summary2d,
|
|
255
|
+
stat_summary_2d,
|
|
256
|
+
stat_summary_hex,
|
|
257
|
+
stat_function,
|
|
258
|
+
stat_ecdf,
|
|
259
|
+
stat_qq,
|
|
260
|
+
stat_qq_line,
|
|
261
|
+
stat_bin2d,
|
|
262
|
+
stat_bin_2d,
|
|
263
|
+
stat_bin_hex,
|
|
264
|
+
stat_binhex,
|
|
265
|
+
stat_contour,
|
|
266
|
+
stat_contour_filled,
|
|
267
|
+
stat_density2d,
|
|
268
|
+
stat_density2d_filled,
|
|
269
|
+
stat_density_2d,
|
|
270
|
+
stat_density_2d_filled,
|
|
271
|
+
stat_ellipse,
|
|
272
|
+
stat_unique,
|
|
273
|
+
stat_sum,
|
|
274
|
+
stat_ydensity,
|
|
275
|
+
stat_align,
|
|
276
|
+
stat_connect,
|
|
277
|
+
stat_manual,
|
|
278
|
+
stat_quantile,
|
|
279
|
+
stat_spoke,
|
|
280
|
+
is_stat,
|
|
281
|
+
mean_se,
|
|
282
|
+
mean_cl_boot,
|
|
283
|
+
mean_cl_normal,
|
|
284
|
+
mean_sdl,
|
|
285
|
+
median_hilow,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
# ---------------------------------------------------------------------------
|
|
289
|
+
# Scales
|
|
290
|
+
# ---------------------------------------------------------------------------
|
|
291
|
+
from ggplot2_py.scale import (
|
|
292
|
+
Scale,
|
|
293
|
+
ScaleContinuous,
|
|
294
|
+
ScaleDiscrete,
|
|
295
|
+
ScaleBinned,
|
|
296
|
+
ScaleContinuousPosition,
|
|
297
|
+
ScaleDiscretePosition,
|
|
298
|
+
ScaleBinnedPosition,
|
|
299
|
+
ScaleContinuousIdentity,
|
|
300
|
+
ScaleDiscreteIdentity,
|
|
301
|
+
ScaleContinuousDate,
|
|
302
|
+
ScaleContinuousDatetime,
|
|
303
|
+
ScalesList,
|
|
304
|
+
AxisSecondary,
|
|
305
|
+
continuous_scale,
|
|
306
|
+
discrete_scale,
|
|
307
|
+
binned_scale,
|
|
308
|
+
sec_axis,
|
|
309
|
+
dup_axis,
|
|
310
|
+
expansion,
|
|
311
|
+
expand_scale,
|
|
312
|
+
find_scale,
|
|
313
|
+
scale_type,
|
|
314
|
+
is_scale,
|
|
315
|
+
)
|
|
316
|
+
from ggplot2_py.scales import (
|
|
317
|
+
scale_x_continuous,
|
|
318
|
+
scale_y_continuous,
|
|
319
|
+
scale_x_discrete,
|
|
320
|
+
scale_y_discrete,
|
|
321
|
+
scale_x_log10,
|
|
322
|
+
scale_y_log10,
|
|
323
|
+
scale_x_sqrt,
|
|
324
|
+
scale_y_sqrt,
|
|
325
|
+
scale_x_reverse,
|
|
326
|
+
scale_y_reverse,
|
|
327
|
+
scale_x_binned,
|
|
328
|
+
scale_y_binned,
|
|
329
|
+
scale_x_date,
|
|
330
|
+
scale_y_date,
|
|
331
|
+
scale_x_datetime,
|
|
332
|
+
scale_y_datetime,
|
|
333
|
+
scale_x_time,
|
|
334
|
+
scale_y_time,
|
|
335
|
+
scale_colour_continuous,
|
|
336
|
+
scale_colour_discrete,
|
|
337
|
+
scale_colour_gradient,
|
|
338
|
+
scale_colour_gradient2,
|
|
339
|
+
scale_colour_gradientn,
|
|
340
|
+
scale_colour_hue,
|
|
341
|
+
scale_colour_brewer,
|
|
342
|
+
scale_colour_distiller,
|
|
343
|
+
scale_colour_fermenter,
|
|
344
|
+
scale_colour_viridis_c,
|
|
345
|
+
scale_colour_viridis_d,
|
|
346
|
+
scale_colour_viridis_b,
|
|
347
|
+
scale_colour_grey,
|
|
348
|
+
scale_colour_identity,
|
|
349
|
+
scale_colour_manual,
|
|
350
|
+
scale_colour_binned,
|
|
351
|
+
scale_colour_steps,
|
|
352
|
+
scale_colour_steps2,
|
|
353
|
+
scale_colour_stepsn,
|
|
354
|
+
scale_colour_date,
|
|
355
|
+
scale_colour_datetime,
|
|
356
|
+
scale_colour_ordinal,
|
|
357
|
+
scale_fill_continuous,
|
|
358
|
+
scale_fill_discrete,
|
|
359
|
+
scale_fill_gradient,
|
|
360
|
+
scale_fill_gradient2,
|
|
361
|
+
scale_fill_gradientn,
|
|
362
|
+
scale_fill_hue,
|
|
363
|
+
scale_fill_brewer,
|
|
364
|
+
scale_fill_distiller,
|
|
365
|
+
scale_fill_fermenter,
|
|
366
|
+
scale_fill_viridis_c,
|
|
367
|
+
scale_fill_viridis_d,
|
|
368
|
+
scale_fill_viridis_b,
|
|
369
|
+
scale_fill_grey,
|
|
370
|
+
scale_fill_identity,
|
|
371
|
+
scale_fill_manual,
|
|
372
|
+
scale_fill_binned,
|
|
373
|
+
scale_fill_steps,
|
|
374
|
+
scale_fill_steps2,
|
|
375
|
+
scale_fill_stepsn,
|
|
376
|
+
scale_fill_date,
|
|
377
|
+
scale_fill_datetime,
|
|
378
|
+
scale_fill_ordinal,
|
|
379
|
+
scale_color_continuous,
|
|
380
|
+
scale_color_discrete,
|
|
381
|
+
scale_color_gradient,
|
|
382
|
+
scale_color_gradient2,
|
|
383
|
+
scale_color_gradientn,
|
|
384
|
+
scale_color_hue,
|
|
385
|
+
scale_color_brewer,
|
|
386
|
+
scale_color_distiller,
|
|
387
|
+
scale_color_fermenter,
|
|
388
|
+
scale_color_viridis_c,
|
|
389
|
+
scale_color_viridis_d,
|
|
390
|
+
scale_color_viridis_b,
|
|
391
|
+
scale_color_grey,
|
|
392
|
+
scale_color_identity,
|
|
393
|
+
scale_color_manual,
|
|
394
|
+
scale_color_binned,
|
|
395
|
+
scale_color_steps,
|
|
396
|
+
scale_color_steps2,
|
|
397
|
+
scale_color_stepsn,
|
|
398
|
+
scale_color_date,
|
|
399
|
+
scale_color_datetime,
|
|
400
|
+
scale_color_ordinal,
|
|
401
|
+
scale_alpha,
|
|
402
|
+
scale_alpha_continuous,
|
|
403
|
+
scale_alpha_discrete,
|
|
404
|
+
scale_alpha_binned,
|
|
405
|
+
scale_alpha_identity,
|
|
406
|
+
scale_alpha_manual,
|
|
407
|
+
scale_alpha_ordinal,
|
|
408
|
+
scale_alpha_date,
|
|
409
|
+
scale_alpha_datetime,
|
|
410
|
+
scale_size,
|
|
411
|
+
scale_size_continuous,
|
|
412
|
+
scale_size_discrete,
|
|
413
|
+
scale_size_binned,
|
|
414
|
+
scale_size_area,
|
|
415
|
+
scale_size_binned_area,
|
|
416
|
+
scale_size_identity,
|
|
417
|
+
scale_size_manual,
|
|
418
|
+
scale_size_ordinal,
|
|
419
|
+
scale_size_date,
|
|
420
|
+
scale_size_datetime,
|
|
421
|
+
scale_radius,
|
|
422
|
+
scale_shape,
|
|
423
|
+
scale_shape_discrete,
|
|
424
|
+
scale_shape_binned,
|
|
425
|
+
scale_shape_identity,
|
|
426
|
+
scale_shape_manual,
|
|
427
|
+
scale_shape_ordinal,
|
|
428
|
+
scale_linetype,
|
|
429
|
+
scale_linetype_discrete,
|
|
430
|
+
scale_linetype_binned,
|
|
431
|
+
scale_linetype_identity,
|
|
432
|
+
scale_linetype_manual,
|
|
433
|
+
scale_linewidth,
|
|
434
|
+
scale_linewidth_continuous,
|
|
435
|
+
scale_linewidth_discrete,
|
|
436
|
+
scale_linewidth_binned,
|
|
437
|
+
scale_linewidth_identity,
|
|
438
|
+
scale_linewidth_manual,
|
|
439
|
+
scale_linewidth_ordinal,
|
|
440
|
+
scale_linewidth_date,
|
|
441
|
+
scale_linewidth_datetime,
|
|
442
|
+
scale_stroke,
|
|
443
|
+
scale_stroke_continuous,
|
|
444
|
+
scale_stroke_discrete,
|
|
445
|
+
scale_stroke_binned,
|
|
446
|
+
scale_stroke_identity,
|
|
447
|
+
scale_stroke_manual,
|
|
448
|
+
scale_stroke_ordinal,
|
|
449
|
+
scale_continuous_identity,
|
|
450
|
+
scale_discrete_identity,
|
|
451
|
+
scale_discrete_manual,
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
# ---------------------------------------------------------------------------
|
|
455
|
+
# Coordinates
|
|
456
|
+
# ---------------------------------------------------------------------------
|
|
457
|
+
from ggplot2_py.coord import (
|
|
458
|
+
Coord,
|
|
459
|
+
CoordCartesian,
|
|
460
|
+
CoordFixed,
|
|
461
|
+
CoordFlip,
|
|
462
|
+
CoordPolar,
|
|
463
|
+
CoordRadial,
|
|
464
|
+
CoordTrans,
|
|
465
|
+
CoordTransform,
|
|
466
|
+
coord_cartesian,
|
|
467
|
+
coord_equal,
|
|
468
|
+
coord_fixed,
|
|
469
|
+
coord_flip,
|
|
470
|
+
coord_polar,
|
|
471
|
+
coord_radial,
|
|
472
|
+
coord_trans,
|
|
473
|
+
coord_transform,
|
|
474
|
+
coord_munch,
|
|
475
|
+
is_coord,
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
# ---------------------------------------------------------------------------
|
|
479
|
+
# Faceting
|
|
480
|
+
# ---------------------------------------------------------------------------
|
|
481
|
+
from ggplot2_py.facet import (
|
|
482
|
+
Facet,
|
|
483
|
+
FacetNull,
|
|
484
|
+
FacetGrid,
|
|
485
|
+
FacetWrap,
|
|
486
|
+
facet_null,
|
|
487
|
+
facet_grid,
|
|
488
|
+
facet_wrap,
|
|
489
|
+
is_facet,
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
# ---------------------------------------------------------------------------
|
|
493
|
+
# Position adjustments
|
|
494
|
+
# ---------------------------------------------------------------------------
|
|
495
|
+
from ggplot2_py.position import (
|
|
496
|
+
Position,
|
|
497
|
+
PositionIdentity,
|
|
498
|
+
PositionDodge,
|
|
499
|
+
PositionDodge2,
|
|
500
|
+
PositionJitter,
|
|
501
|
+
PositionJitterdodge,
|
|
502
|
+
PositionNudge,
|
|
503
|
+
PositionStack,
|
|
504
|
+
PositionFill,
|
|
505
|
+
position_identity,
|
|
506
|
+
position_dodge,
|
|
507
|
+
position_dodge2,
|
|
508
|
+
position_jitter,
|
|
509
|
+
position_jitterdodge,
|
|
510
|
+
position_nudge,
|
|
511
|
+
position_stack,
|
|
512
|
+
position_fill,
|
|
513
|
+
is_position,
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
# ---------------------------------------------------------------------------
|
|
517
|
+
# Guides
|
|
518
|
+
# ---------------------------------------------------------------------------
|
|
519
|
+
from ggplot2_py.guide import (
|
|
520
|
+
Guide,
|
|
521
|
+
GuideAxis,
|
|
522
|
+
GuideAxisLogticks,
|
|
523
|
+
GuideAxisStack,
|
|
524
|
+
GuideAxisTheta,
|
|
525
|
+
GuideBins,
|
|
526
|
+
GuideColourbar,
|
|
527
|
+
GuideColoursteps,
|
|
528
|
+
GuideCustom,
|
|
529
|
+
GuideLegend,
|
|
530
|
+
GuideNone,
|
|
531
|
+
guide_axis,
|
|
532
|
+
guide_axis_logticks,
|
|
533
|
+
guide_axis_stack,
|
|
534
|
+
guide_axis_theta,
|
|
535
|
+
guide_bins,
|
|
536
|
+
guide_colourbar,
|
|
537
|
+
guide_colorbar,
|
|
538
|
+
guide_coloursteps,
|
|
539
|
+
guide_colorsteps,
|
|
540
|
+
guide_custom,
|
|
541
|
+
guide_legend,
|
|
542
|
+
guide_none,
|
|
543
|
+
guides,
|
|
544
|
+
is_guide,
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
# ---------------------------------------------------------------------------
|
|
548
|
+
# Themes
|
|
549
|
+
# ---------------------------------------------------------------------------
|
|
550
|
+
from ggplot2_py.theme import (
|
|
551
|
+
theme,
|
|
552
|
+
is_theme,
|
|
553
|
+
complete_theme,
|
|
554
|
+
theme_get,
|
|
555
|
+
theme_set,
|
|
556
|
+
theme_update,
|
|
557
|
+
theme_replace,
|
|
558
|
+
set_theme,
|
|
559
|
+
get_theme,
|
|
560
|
+
reset_theme_settings,
|
|
561
|
+
update_theme,
|
|
562
|
+
replace_theme,
|
|
563
|
+
)
|
|
564
|
+
from ggplot2_py.theme_elements import (
|
|
565
|
+
Element,
|
|
566
|
+
element_blank,
|
|
567
|
+
element_line,
|
|
568
|
+
element_rect,
|
|
569
|
+
element_text,
|
|
570
|
+
element_point,
|
|
571
|
+
element_polygon,
|
|
572
|
+
element_geom,
|
|
573
|
+
element_grob,
|
|
574
|
+
element_render,
|
|
575
|
+
el_def,
|
|
576
|
+
merge_element,
|
|
577
|
+
is_theme_element,
|
|
578
|
+
Margin,
|
|
579
|
+
margin,
|
|
580
|
+
margin_auto,
|
|
581
|
+
margin_part,
|
|
582
|
+
Rel,
|
|
583
|
+
rel,
|
|
584
|
+
calc_element,
|
|
585
|
+
get_element_tree,
|
|
586
|
+
register_theme_elements,
|
|
587
|
+
)
|
|
588
|
+
from ggplot2_py.theme_defaults import (
|
|
589
|
+
theme_grey,
|
|
590
|
+
theme_gray,
|
|
591
|
+
theme_bw,
|
|
592
|
+
theme_linedraw,
|
|
593
|
+
theme_light,
|
|
594
|
+
theme_dark,
|
|
595
|
+
theme_minimal,
|
|
596
|
+
theme_classic,
|
|
597
|
+
theme_void,
|
|
598
|
+
theme_test,
|
|
599
|
+
)
|
|
600
|
+
|
|
601
|
+
# ---------------------------------------------------------------------------
|
|
602
|
+
# Labels, limits, annotations
|
|
603
|
+
# ---------------------------------------------------------------------------
|
|
604
|
+
from ggplot2_py.labels import labs, xlab, ylab, ggtitle
|
|
605
|
+
from ggplot2_py.limits import lims, xlim, ylim, expand_limits
|
|
606
|
+
from ggplot2_py.annotation import (
|
|
607
|
+
annotate,
|
|
608
|
+
annotation_custom,
|
|
609
|
+
annotation_raster,
|
|
610
|
+
annotation_logticks,
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
# ---------------------------------------------------------------------------
|
|
614
|
+
# Draw keys
|
|
615
|
+
# ---------------------------------------------------------------------------
|
|
616
|
+
from ggplot2_py.draw_key import (
|
|
617
|
+
draw_key_point,
|
|
618
|
+
draw_key_path,
|
|
619
|
+
draw_key_rect,
|
|
620
|
+
draw_key_polygon,
|
|
621
|
+
draw_key_blank,
|
|
622
|
+
draw_key_boxplot,
|
|
623
|
+
draw_key_crossbar,
|
|
624
|
+
draw_key_dotplot,
|
|
625
|
+
draw_key_label,
|
|
626
|
+
draw_key_linerange,
|
|
627
|
+
draw_key_pointrange,
|
|
628
|
+
draw_key_smooth,
|
|
629
|
+
draw_key_text,
|
|
630
|
+
draw_key_abline,
|
|
631
|
+
draw_key_vline,
|
|
632
|
+
draw_key_timeseries,
|
|
633
|
+
draw_key_vpath,
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
# ---------------------------------------------------------------------------
|
|
637
|
+
# Save, fortify, qplot
|
|
638
|
+
# ---------------------------------------------------------------------------
|
|
639
|
+
from ggplot2_py.save import ggsave, check_device
|
|
640
|
+
from ggplot2_py.fortify import fortify
|
|
641
|
+
from ggplot2_py.qplot import qplot, quickplot
|
|
642
|
+
|
|
643
|
+
# ---------------------------------------------------------------------------
|
|
644
|
+
# Utility re-exports (matching R namespace)
|
|
645
|
+
# ---------------------------------------------------------------------------
|
|
646
|
+
from ggplot2_py._utils import resolution, remove_missing
|
|
647
|
+
|
|
648
|
+
# grid re-exports (matching R: importFrom(grid, unit, arrow))
|
|
649
|
+
from grid_py import Unit as unit, arrow
|
|
650
|
+
from scales import alpha
|
|
651
|
+
|
|
652
|
+
# Constants
|
|
653
|
+
PT = 72.27 / 25.4 # points per mm
|
|
654
|
+
STROKE = 96 / 25.4 # pixels per mm
|
|
655
|
+
|
|
656
|
+
# Derived aliases
|
|
657
|
+
derive = None # placeholder for axis derivation sentinel
|
|
658
|
+
flip_data = None # placeholder
|
|
659
|
+
flipped_names = None # placeholder
|
|
660
|
+
has_flipped_aes = None # placeholder
|
|
661
|
+
|
|
662
|
+
# ---------------------------------------------------------------------------
|
|
663
|
+
# __all__
|
|
664
|
+
# ---------------------------------------------------------------------------
|
|
665
|
+
__all__ = [
|
|
666
|
+
# Version
|
|
667
|
+
"__version__",
|
|
668
|
+
# Core
|
|
669
|
+
"GGProto", "ggproto", "ggproto_parent", "is_ggproto",
|
|
670
|
+
"Waiver", "waiver", "is_waiver",
|
|
671
|
+
# Aesthetics
|
|
672
|
+
"aes", "after_stat", "after_scale", "stage", "vars",
|
|
673
|
+
"is_mapping", "standardise_aes_names",
|
|
674
|
+
# Datasets
|
|
675
|
+
"datasets",
|
|
676
|
+
# Layer
|
|
677
|
+
"Layer", "layer", "is_layer",
|
|
678
|
+
# Plot
|
|
679
|
+
"ggplot", "is_ggplot", "ggplot_build", "ggplot_gtable", "ggplotGrob",
|
|
680
|
+
"ggplot_add", "add_gg", "get_last_plot", "set_last_plot", "last_plot",
|
|
681
|
+
"print_plot", "get_alt_text", "update_ggplot",
|
|
682
|
+
# Introspection
|
|
683
|
+
"get_layer_data", "get_layer_grob", "get_panel_scales",
|
|
684
|
+
"get_guide_data", "get_strip_labels", "get_labs",
|
|
685
|
+
"layer_data", "layer_grob", "layer_scales",
|
|
686
|
+
"summarise_plot", "summarise_coord", "summarise_layers", "summarise_layout",
|
|
687
|
+
"find_panel", "panel_rows", "panel_cols",
|
|
688
|
+
# Geom classes
|
|
689
|
+
"Geom", "GeomPoint", "GeomPath", "GeomLine", "GeomStep",
|
|
690
|
+
"GeomBar", "GeomCol", "GeomRect", "GeomTile", "GeomRaster",
|
|
691
|
+
"GeomText", "GeomLabel", "GeomBoxplot", "GeomViolin", "GeomDotplot",
|
|
692
|
+
"GeomRibbon", "GeomArea", "GeomSmooth", "GeomPolygon",
|
|
693
|
+
"GeomErrorbar", "GeomErrorbarh", "GeomCrossbar", "GeomLinerange", "GeomPointrange",
|
|
694
|
+
"GeomSegment", "GeomCurve", "GeomSpoke",
|
|
695
|
+
"GeomDensity", "GeomDensity2d", "GeomDensity2dFilled",
|
|
696
|
+
"GeomContour", "GeomContourFilled",
|
|
697
|
+
"GeomHex", "GeomBin2d", "GeomAbline", "GeomHline", "GeomVline",
|
|
698
|
+
"GeomRug", "GeomBlank", "GeomFunction", "GeomSf",
|
|
699
|
+
# Geom constructors
|
|
700
|
+
"geom_point", "geom_path", "geom_line", "geom_step",
|
|
701
|
+
"geom_bar", "geom_col", "geom_rect", "geom_tile", "geom_raster",
|
|
702
|
+
"geom_text", "geom_label", "geom_boxplot", "geom_violin", "geom_dotplot",
|
|
703
|
+
"geom_ribbon", "geom_area", "geom_smooth", "geom_polygon",
|
|
704
|
+
"geom_errorbar", "geom_errorbarh", "geom_crossbar", "geom_linerange", "geom_pointrange",
|
|
705
|
+
"geom_segment", "geom_curve", "geom_spoke",
|
|
706
|
+
"geom_density", "geom_density2d", "geom_density2d_filled",
|
|
707
|
+
"geom_density_2d", "geom_density_2d_filled",
|
|
708
|
+
"geom_contour", "geom_contour_filled",
|
|
709
|
+
"geom_hex", "geom_bin2d", "geom_bin_2d",
|
|
710
|
+
"geom_abline", "geom_hline", "geom_vline",
|
|
711
|
+
"geom_rug", "geom_blank", "geom_function",
|
|
712
|
+
"geom_histogram", "geom_freqpoly", "geom_count", "geom_jitter",
|
|
713
|
+
"geom_map", "geom_quantile",
|
|
714
|
+
"geom_sf", "geom_sf_label", "geom_sf_text",
|
|
715
|
+
"geom_qq", "geom_qq_line",
|
|
716
|
+
"is_geom",
|
|
717
|
+
# Stat classes
|
|
718
|
+
"Stat", "StatIdentity", "StatBin", "StatCount", "StatDensity",
|
|
719
|
+
"StatSmooth", "StatBoxplot", "StatSummary", "StatSummaryBin",
|
|
720
|
+
"StatSummary2d", "StatSummaryHex", "StatFunction", "StatEcdf",
|
|
721
|
+
"StatQq", "StatQqLine", "StatBin2d", "StatBinhex",
|
|
722
|
+
"StatContour", "StatContourFilled",
|
|
723
|
+
"StatDensity2d", "StatDensity2dFilled",
|
|
724
|
+
"StatEllipse", "StatUnique", "StatSum", "StatYdensity",
|
|
725
|
+
"StatBindot", "StatAlign", "StatConnect", "StatManual", "StatQuantile",
|
|
726
|
+
# Stat constructors
|
|
727
|
+
"stat_identity", "stat_bin", "stat_count", "stat_density",
|
|
728
|
+
"stat_smooth", "stat_boxplot", "stat_summary", "stat_summary_bin",
|
|
729
|
+
"stat_summary2d", "stat_summary_2d", "stat_summary_hex",
|
|
730
|
+
"stat_function", "stat_ecdf",
|
|
731
|
+
"stat_qq", "stat_qq_line",
|
|
732
|
+
"stat_bin2d", "stat_bin_2d", "stat_bin_hex", "stat_binhex",
|
|
733
|
+
"stat_contour", "stat_contour_filled",
|
|
734
|
+
"stat_density2d", "stat_density2d_filled",
|
|
735
|
+
"stat_density_2d", "stat_density_2d_filled",
|
|
736
|
+
"stat_ellipse", "stat_unique", "stat_sum", "stat_ydensity",
|
|
737
|
+
"stat_align", "stat_connect", "stat_manual", "stat_quantile", "stat_spoke",
|
|
738
|
+
"is_stat",
|
|
739
|
+
"mean_se", "mean_cl_boot", "mean_cl_normal", "mean_sdl", "median_hilow",
|
|
740
|
+
# Scale classes
|
|
741
|
+
"Scale", "ScaleContinuous", "ScaleDiscrete", "ScaleBinned",
|
|
742
|
+
"ScaleContinuousPosition", "ScaleDiscretePosition", "ScaleBinnedPosition",
|
|
743
|
+
"ScaleContinuousIdentity", "ScaleDiscreteIdentity",
|
|
744
|
+
"ScaleContinuousDate", "ScaleContinuousDatetime",
|
|
745
|
+
"ScalesList", "AxisSecondary",
|
|
746
|
+
"continuous_scale", "discrete_scale", "binned_scale",
|
|
747
|
+
"sec_axis", "dup_axis", "expansion", "expand_scale",
|
|
748
|
+
"find_scale", "scale_type", "is_scale",
|
|
749
|
+
# Scale constructors (selected)
|
|
750
|
+
"scale_x_continuous", "scale_y_continuous",
|
|
751
|
+
"scale_x_discrete", "scale_y_discrete",
|
|
752
|
+
"scale_x_log10", "scale_y_log10",
|
|
753
|
+
"scale_x_sqrt", "scale_y_sqrt",
|
|
754
|
+
"scale_x_reverse", "scale_y_reverse",
|
|
755
|
+
"scale_x_binned", "scale_y_binned",
|
|
756
|
+
"scale_x_date", "scale_y_date",
|
|
757
|
+
"scale_x_datetime", "scale_y_datetime",
|
|
758
|
+
"scale_colour_continuous", "scale_colour_discrete",
|
|
759
|
+
"scale_colour_gradient", "scale_colour_gradient2", "scale_colour_gradientn",
|
|
760
|
+
"scale_colour_hue", "scale_colour_brewer",
|
|
761
|
+
"scale_colour_viridis_c", "scale_colour_viridis_d",
|
|
762
|
+
"scale_colour_grey", "scale_colour_identity", "scale_colour_manual",
|
|
763
|
+
"scale_fill_continuous", "scale_fill_discrete",
|
|
764
|
+
"scale_fill_gradient", "scale_fill_gradient2", "scale_fill_gradientn",
|
|
765
|
+
"scale_fill_hue", "scale_fill_brewer",
|
|
766
|
+
"scale_fill_viridis_c", "scale_fill_viridis_d",
|
|
767
|
+
"scale_fill_grey", "scale_fill_identity", "scale_fill_manual",
|
|
768
|
+
"scale_color_continuous", "scale_color_discrete",
|
|
769
|
+
"scale_color_gradient", "scale_color_gradient2", "scale_color_gradientn",
|
|
770
|
+
"scale_color_hue", "scale_color_brewer",
|
|
771
|
+
"scale_color_viridis_c", "scale_color_viridis_d",
|
|
772
|
+
"scale_color_grey", "scale_color_identity", "scale_color_manual",
|
|
773
|
+
"scale_alpha", "scale_alpha_continuous", "scale_alpha_discrete",
|
|
774
|
+
"scale_size", "scale_size_continuous", "scale_size_area",
|
|
775
|
+
"scale_shape", "scale_shape_discrete",
|
|
776
|
+
"scale_linetype", "scale_linetype_discrete",
|
|
777
|
+
"scale_linewidth", "scale_linewidth_continuous",
|
|
778
|
+
"scale_stroke", "scale_stroke_continuous",
|
|
779
|
+
# Coords
|
|
780
|
+
"Coord", "CoordCartesian", "CoordFixed", "CoordFlip",
|
|
781
|
+
"CoordPolar", "CoordRadial", "CoordTrans", "CoordTransform",
|
|
782
|
+
"coord_cartesian", "coord_equal", "coord_fixed", "coord_flip",
|
|
783
|
+
"coord_polar", "coord_radial", "coord_trans", "coord_transform",
|
|
784
|
+
"coord_munch", "is_coord",
|
|
785
|
+
# Facets
|
|
786
|
+
"Facet", "FacetNull", "FacetGrid", "FacetWrap",
|
|
787
|
+
"facet_null", "facet_grid", "facet_wrap", "is_facet",
|
|
788
|
+
# Positions
|
|
789
|
+
"Position", "PositionIdentity", "PositionDodge", "PositionDodge2",
|
|
790
|
+
"PositionJitter", "PositionJitterdodge", "PositionNudge",
|
|
791
|
+
"PositionStack", "PositionFill",
|
|
792
|
+
"position_identity", "position_dodge", "position_dodge2",
|
|
793
|
+
"position_jitter", "position_jitterdodge", "position_nudge",
|
|
794
|
+
"position_stack", "position_fill", "is_position",
|
|
795
|
+
# Guides
|
|
796
|
+
"Guide", "GuideAxis", "GuideAxisLogticks", "GuideAxisStack",
|
|
797
|
+
"GuideAxisTheta", "GuideBins", "GuideColourbar", "GuideColoursteps",
|
|
798
|
+
"GuideCustom", "GuideLegend", "GuideNone",
|
|
799
|
+
"guide_axis", "guide_legend", "guide_colourbar", "guide_colorbar",
|
|
800
|
+
"guide_coloursteps", "guide_colorsteps", "guide_bins",
|
|
801
|
+
"guide_custom", "guide_none", "guides", "is_guide",
|
|
802
|
+
# Themes
|
|
803
|
+
"theme", "is_theme", "complete_theme",
|
|
804
|
+
"theme_get", "theme_set", "theme_update", "theme_replace",
|
|
805
|
+
"set_theme", "get_theme", "reset_theme_settings",
|
|
806
|
+
"Element", "element_blank", "element_line", "element_rect",
|
|
807
|
+
"element_text", "element_point", "element_polygon", "element_geom",
|
|
808
|
+
"element_grob", "element_render", "merge_element",
|
|
809
|
+
"Margin", "margin", "Rel", "rel",
|
|
810
|
+
"calc_element", "get_element_tree", "register_theme_elements",
|
|
811
|
+
"theme_grey", "theme_gray", "theme_bw", "theme_linedraw",
|
|
812
|
+
"theme_light", "theme_dark", "theme_minimal", "theme_classic",
|
|
813
|
+
"theme_void", "theme_test",
|
|
814
|
+
# Labels, limits
|
|
815
|
+
"labs", "xlab", "ylab", "ggtitle",
|
|
816
|
+
"lims", "xlim", "ylim", "expand_limits",
|
|
817
|
+
# Annotations
|
|
818
|
+
"annotate", "annotation_custom", "annotation_raster", "annotation_logticks",
|
|
819
|
+
# Draw keys
|
|
820
|
+
"draw_key_point", "draw_key_path", "draw_key_rect", "draw_key_polygon",
|
|
821
|
+
"draw_key_blank", "draw_key_boxplot", "draw_key_crossbar",
|
|
822
|
+
"draw_key_dotplot", "draw_key_label", "draw_key_linerange",
|
|
823
|
+
"draw_key_pointrange", "draw_key_smooth", "draw_key_text",
|
|
824
|
+
"draw_key_abline", "draw_key_vline", "draw_key_timeseries", "draw_key_vpath",
|
|
825
|
+
# Save, fortify, qplot
|
|
826
|
+
"ggsave", "check_device", "fortify", "qplot", "quickplot",
|
|
827
|
+
# Utilities
|
|
828
|
+
"resolution", "remove_missing",
|
|
829
|
+
"unit", "arrow", "alpha",
|
|
830
|
+
"PT", "STROKE",
|
|
831
|
+
# Plugin discovery
|
|
832
|
+
"discover_extensions", "list_extensions",
|
|
833
|
+
]
|
|
834
|
+
|
|
835
|
+
# ---------------------------------------------------------------------------
|
|
836
|
+
# Initialize the global theme state — mirrors R's on_load block in
|
|
837
|
+
# ``theme-elements.R:727-733`` which calls ``reset_theme_settings()`` to
|
|
838
|
+
# establish ``theme_default = theme_grey()`` and ``theme_current`` before
|
|
839
|
+
# any plot is built. Without this, ``complete_theme`` cannot fall back
|
|
840
|
+
# to a valid default, and all downstream ``calc_element`` resolutions
|
|
841
|
+
# return ``None``.
|
|
842
|
+
# ---------------------------------------------------------------------------
|
|
843
|
+
reset_theme_settings()
|
|
844
|
+
|
|
845
|
+
# ---------------------------------------------------------------------------
|
|
846
|
+
# Entry-point plugin discovery — scan installed packages for extensions.
|
|
847
|
+
# This runs once at import time. Extensions that fail to load emit a
|
|
848
|
+
# warning but do not block import.
|
|
849
|
+
# ---------------------------------------------------------------------------
|
|
850
|
+
from ggplot2_py._plugins import discover_extensions, list_extensions
|
|
851
|
+
|
|
852
|
+
discover_extensions()
|