plotnine 0.15.0a6__py3-none-any.whl → 0.15.0a8__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.
Files changed (55) hide show
  1. plotnine/_mpl/layout_manager/_engine.py +2 -2
  2. plotnine/_mpl/layout_manager/_layout_items.py +6 -2
  3. plotnine/_mpl/layout_manager/_layout_tree.py +219 -58
  4. plotnine/_mpl/layout_manager/_spaces.py +98 -28
  5. plotnine/_mpl/text.py +1 -7
  6. plotnine/composition/__init__.py +2 -2
  7. plotnine/composition/_beside.py +12 -4
  8. plotnine/composition/{_arrange.py → _compose.py} +118 -38
  9. plotnine/composition/_plot_spacer.py +6 -0
  10. plotnine/composition/_stack.py +12 -4
  11. plotnine/geoms/geom_bar.py +1 -0
  12. plotnine/geoms/geom_bin_2d.py +4 -0
  13. plotnine/geoms/geom_boxplot.py +4 -0
  14. plotnine/geoms/geom_count.py +4 -0
  15. plotnine/geoms/geom_density_2d.py +4 -0
  16. plotnine/geoms/geom_dotplot.py +1 -1
  17. plotnine/geoms/geom_histogram.py +1 -1
  18. plotnine/geoms/geom_pointdensity.py +4 -0
  19. plotnine/geoms/geom_qq.py +4 -0
  20. plotnine/geoms/geom_qq_line.py +4 -0
  21. plotnine/geoms/geom_quantile.py +4 -0
  22. plotnine/geoms/geom_sina.py +1 -1
  23. plotnine/geoms/geom_smooth.py +4 -0
  24. plotnine/geoms/geom_violin.py +4 -0
  25. plotnine/ggplot.py +4 -4
  26. plotnine/stats/stat_bin.py +4 -0
  27. plotnine/stats/stat_bin_2d.py +4 -0
  28. plotnine/stats/stat_bindot.py +1 -0
  29. plotnine/stats/stat_boxplot.py +1 -1
  30. plotnine/stats/stat_count.py +1 -0
  31. plotnine/stats/stat_density.py +1 -1
  32. plotnine/stats/stat_density_2d.py +1 -0
  33. plotnine/stats/stat_ecdf.py +1 -1
  34. plotnine/stats/stat_ellipse.py +4 -0
  35. plotnine/stats/stat_function.py +4 -0
  36. plotnine/stats/stat_hull.py +4 -0
  37. plotnine/stats/stat_identity.py +4 -0
  38. plotnine/stats/stat_pointdensity.py +1 -0
  39. plotnine/stats/stat_qq.py +1 -0
  40. plotnine/stats/stat_qq_line.py +1 -0
  41. plotnine/stats/stat_quantile.py +1 -1
  42. plotnine/stats/stat_sina.py +1 -1
  43. plotnine/stats/stat_smooth.py +1 -0
  44. plotnine/stats/stat_sum.py +4 -0
  45. plotnine/stats/stat_summary.py +1 -1
  46. plotnine/stats/stat_summary_bin.py +1 -1
  47. plotnine/stats/stat_unique.py +4 -0
  48. plotnine/stats/stat_ydensity.py +1 -1
  49. plotnine/themes/theme.py +1 -1
  50. plotnine/themes/theme_void.py +1 -7
  51. {plotnine-0.15.0a6.dist-info → plotnine-0.15.0a8.dist-info}/METADATA +1 -1
  52. {plotnine-0.15.0a6.dist-info → plotnine-0.15.0a8.dist-info}/RECORD +55 -55
  53. {plotnine-0.15.0a6.dist-info → plotnine-0.15.0a8.dist-info}/WHEEL +0 -0
  54. {plotnine-0.15.0a6.dist-info → plotnine-0.15.0a8.dist-info}/licenses/LICENSE +0 -0
  55. {plotnine-0.15.0a6.dist-info → plotnine-0.15.0a8.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,16 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from dataclasses import dataclass
3
4
  from typing import TYPE_CHECKING
4
5
 
5
- from ._arrange import Arrange
6
+ from ._compose import Compose
6
7
 
7
8
  if TYPE_CHECKING:
8
9
  from plotnine.ggplot import ggplot
9
10
 
10
11
 
11
- class Stack(Arrange):
12
+ @dataclass
13
+ class Stack(Compose):
12
14
  """
13
15
  Place plots or compositions on top of each other
14
16
 
@@ -20,6 +22,12 @@ class Stack(Arrange):
20
22
  composition / composition
21
23
 
22
24
  Typically, you will use this class through the `/` operator.
25
+
26
+ See Also
27
+ --------
28
+ plotnine.composition.Beside : To arrange plots side by side
29
+ plotnine.composition.plot_spacer : To add a blank space between plots
30
+ plotnine.composition.Compose : For more on composing plots
23
31
  """
24
32
 
25
33
  @property
@@ -30,7 +38,7 @@ class Stack(Arrange):
30
38
  def ncol(self) -> int:
31
39
  return 1
32
40
 
33
- def __truediv__(self, rhs: ggplot | Arrange) -> Arrange:
41
+ def __truediv__(self, rhs: ggplot | Compose) -> Compose:
34
42
  """
35
43
  Add rhs as a row
36
44
  """
@@ -38,7 +46,7 @@ class Stack(Arrange):
38
46
  # operands into a single operation
39
47
  return Stack([*self, rhs])
40
48
 
41
- def __or__(self, rhs: ggplot | Arrange) -> Arrange:
49
+ def __or__(self, rhs: ggplot | Compose) -> Compose:
42
50
  """
43
51
  Add rhs as a column
44
52
  """
@@ -32,6 +32,7 @@ class geom_bar(geom_rect):
32
32
  See Also
33
33
  --------
34
34
  plotnine.geom_histogram
35
+ plotnine.stat_count : The default `stat` for this `geom`.
35
36
  """
36
37
 
37
38
  REQUIRED_AES = {"x", "y"}
@@ -17,6 +17,10 @@ class geom_bin_2d(geom_rect):
17
17
  Parameters
18
18
  ----------
19
19
  {common_parameters}
20
+
21
+ See Also
22
+ --------
23
+ plotnine.stat_bin_2d : The default stat for this `geom`.
20
24
  """
21
25
 
22
26
  DEFAULT_PARAMS = {"stat": "bin_2d", "position": "identity", "na_rm": False}
@@ -70,6 +70,10 @@ class geom_boxplot(geom):
70
70
  fatten : float, default=2
71
71
  A multiplicative factor used to increase the size of the
72
72
  middle bar across the box.
73
+
74
+ See Also
75
+ --------
76
+ plotnine.stat_boxplot : The default `stat` for this `geom`.
73
77
  """
74
78
 
75
79
  DEFAULT_AES = {
@@ -16,6 +16,10 @@ class geom_count(geom_point):
16
16
  Parameters
17
17
  ----------
18
18
  {common_parameters}
19
+
20
+ See Also
21
+ --------
22
+ plotnine.stat_sum : The default `stat` for this `geom`.
19
23
  """
20
24
 
21
25
  DEFAULT_PARAMS = {"stat": "sum", "position": "identity", "na_rm": False}
@@ -14,6 +14,10 @@ class geom_density_2d(geom_path):
14
14
  Parameters
15
15
  ----------
16
16
  {common_parameters}
17
+
18
+ See Also
19
+ --------
20
+ plotnine.stat_density_2d : The default `stat` for this `geom`.
17
21
  """
18
22
 
19
23
  DEFAULT_PARAMS = {
@@ -46,7 +46,7 @@ class geom_dotplot(geom):
46
46
 
47
47
  See Also
48
48
  --------
49
- plotnine.stat_bindot
49
+ plotnine.stat_bindot : The default `stat` for this `geom`.
50
50
  """
51
51
 
52
52
  DEFAULT_AES = {"alpha": 1, "color": "black", "fill": "black"}
@@ -15,7 +15,7 @@ class geom_histogram(geom_bar):
15
15
 
16
16
  See Also
17
17
  --------
18
- plotnine.geom_bar
18
+ plotnine.geom_bar : The default `stat` for this `geom`.
19
19
  """
20
20
 
21
21
  DEFAULT_PARAMS = {"stat": "bin", "position": "stack", "na_rm": False}
@@ -12,6 +12,10 @@ class geom_pointdensity(geom_point):
12
12
  Parameters
13
13
  ----------
14
14
  {common_parameters}
15
+
16
+ See Also
17
+ --------
18
+ plotnine.stat_pointdensity : The default `stat` for this `geom`.
15
19
  """
16
20
 
17
21
  DEFAULT_PARAMS = {
plotnine/geoms/geom_qq.py CHANGED
@@ -12,6 +12,10 @@ class geom_qq(geom_point):
12
12
  Parameters
13
13
  ----------
14
14
  {common_parameters}
15
+
16
+ See Also
17
+ --------
18
+ plotnine.stat_qq : The default `stat` for this `geom`.
15
19
  """
16
20
 
17
21
  DEFAULT_PARAMS = {"stat": "qq", "position": "identity", "na_rm": False}
@@ -12,6 +12,10 @@ class geom_qq_line(geom_path):
12
12
  Parameters
13
13
  ----------
14
14
  {common_parameters}
15
+
16
+ See Also
17
+ --------
18
+ plotnine.stat_qq_line : The default `stat` for this `geom`.
15
19
  """
16
20
 
17
21
  DEFAULT_PARAMS = {
@@ -16,6 +16,10 @@ class geom_quantile(geom_path):
16
16
  Line end style. This option is applied for solid linetypes.
17
17
  linejoin : Literal["round", "miter", "bevel"], default="round"
18
18
  Line join style. This option is applied for solid linetypes.
19
+
20
+ See Also
21
+ --------
22
+ plotnine.stat_quantile : The default `stat` for this `geom`.
19
23
  """
20
24
 
21
25
  DEFAULT_AES = {
@@ -20,7 +20,7 @@ class geom_sina(geom_point):
20
20
 
21
21
  See Also
22
22
  --------
23
- plotnine.stat_sina
23
+ plotnine.stat_sina : The default `stat` for this `geom`.
24
24
 
25
25
  References
26
26
  ----------
@@ -34,6 +34,10 @@ class geom_smooth(geom):
34
34
  How much (vertically) of the legend box should be filled by
35
35
  the color that indicates the confidence intervals. Should be
36
36
  in the range [0, 1].
37
+
38
+ See Also
39
+ --------
40
+ plotnine.stat_smooth : The default `stat` for this `geom`.
37
41
  """
38
42
 
39
43
  DEFAULT_AES = {
@@ -45,6 +45,10 @@ class geom_violin(geom):
45
45
  'left-right' # Alternate (left first) half violins by the group
46
46
  'right-left' # Alternate (right first) half violins by the group
47
47
  ```
48
+
49
+ See Also
50
+ --------
51
+ plotnine.stat_ydensity : The default `stat` for this `geom`.
48
52
  """
49
53
 
50
54
  DEFAULT_AES = {
plotnine/ggplot.py CHANGED
@@ -52,7 +52,7 @@ if TYPE_CHECKING:
52
52
 
53
53
  from plotnine import watermark
54
54
  from plotnine._mpl.gridspec import p9GridSpec
55
- from plotnine.composition import Arrange
55
+ from plotnine.composition import Compose
56
56
  from plotnine.coords.coord import coord
57
57
  from plotnine.facets.facet import facet
58
58
  from plotnine.layer import layer
@@ -245,7 +245,7 @@ class ggplot:
245
245
  self = deepcopy(self)
246
246
  return self.__iadd__(rhs)
247
247
 
248
- def __or__(self, rhs: ggplot | Arrange) -> Arrange:
248
+ def __or__(self, rhs: ggplot | Compose) -> Compose:
249
249
  """
250
250
  Compose 2 plots columnwise
251
251
  """
@@ -253,7 +253,7 @@ class ggplot:
253
253
 
254
254
  return Beside([self, rhs])
255
255
 
256
- def __truediv__(self, rhs: ggplot | Arrange) -> Arrange:
256
+ def __truediv__(self, rhs: ggplot | Compose) -> Compose:
257
257
  """
258
258
  Compose 2 plots rowwise
259
259
  """
@@ -261,7 +261,7 @@ class ggplot:
261
261
 
262
262
  return Stack([self, rhs])
263
263
 
264
- def __sub__(self, rhs: ggplot | Arrange) -> Arrange:
264
+ def __sub__(self, rhs: ggplot | Compose) -> Compose:
265
265
  """
266
266
  Compose 2 plots columnwise
267
267
  """
@@ -53,6 +53,10 @@ class stat_bin(stat):
53
53
  pad : bool, default=False
54
54
  If `True`{.py}, adds empty bins at either side of x.
55
55
  This ensures that frequency polygons touch 0.
56
+
57
+ See Also
58
+ --------
59
+ plotnine.histogram : The default `geom` for this `stat`.
56
60
  """
57
61
 
58
62
  _aesthetics_doc = """
@@ -35,6 +35,10 @@ class stat_bin_2d(stat):
35
35
  the stories in your data.
36
36
  drop : bool, default=False
37
37
  If `True`{.py}, removes all cells with zero counts.
38
+
39
+ See Also
40
+ --------
41
+ plotnine.geom_rect : The default `geom` for this `stat`.
38
42
  """
39
43
 
40
44
  _aesthetics_doc = """
@@ -68,6 +68,7 @@ class stat_bindot(stat):
68
68
 
69
69
  See Also
70
70
  --------
71
+ plotnine.geom_dotplot : The default `geom` for this `stat`.
71
72
  plotnine.stat_bin
72
73
  """
73
74
 
@@ -22,7 +22,7 @@ class stat_boxplot(stat):
22
22
 
23
23
  See Also
24
24
  --------
25
- plotnine.geom_boxplot
25
+ plotnine.geom_boxplot: The default `geom` for this `stat`.
26
26
  """
27
27
 
28
28
  _aesthetics_doc = """
@@ -23,6 +23,7 @@ class stat_count(stat):
23
23
 
24
24
  See Also
25
25
  --------
26
+ plotnine.geom_histogram : The default `geom` for this `stat`.
26
27
  plotnine.stat_bin
27
28
  """
28
29
 
@@ -85,7 +85,7 @@ class stat_density(stat):
85
85
 
86
86
  See Also
87
87
  --------
88
- plotnine.geom_density
88
+ plotnine.geom_density : The default `geom` for this `stat`.
89
89
  statsmodels.nonparametric.kde.KDEUnivariate
90
90
  statsmodels.nonparametric.kde.KDEUnivariate.fit
91
91
  """
@@ -37,6 +37,7 @@ class stat_density_2d(stat):
37
37
 
38
38
  See Also
39
39
  --------
40
+ plotnine.geom_density_2d : The default `geom` for this `stat`.
40
41
  statsmodels.nonparametric.kernel_density.KDEMultivariate
41
42
  scipy.stats.gaussian_kde
42
43
  sklearn.neighbors.KernelDensity
@@ -25,7 +25,7 @@ class stat_ecdf(stat):
25
25
 
26
26
  See Also
27
27
  --------
28
- plotnine.geom_step
28
+ plotnine.geom_step : The default `geom` for this `stat`.
29
29
  """
30
30
 
31
31
  _aesthetics_doc = """
@@ -37,6 +37,10 @@ class stat_ellipse(stat):
37
37
  The confidence level at which to draw the ellipse.
38
38
  segments : int, default=51
39
39
  Number of segments to be used in drawing the ellipse.
40
+
41
+ See Also
42
+ --------
43
+ plotnine.geom_path : The default `geom` for this `stat`.
40
44
  """
41
45
 
42
46
  REQUIRED_AES = {"x", "y"}
@@ -37,6 +37,10 @@ class stat_function(stat):
37
37
  then the `xlim` must be provided.
38
38
  args : Optional[tuple[Any] | dict[str, Any]], default=None
39
39
  Arguments to pass to `fun`.
40
+
41
+ See Also
42
+ --------
43
+ plotnine.geom_path : The default `geom` for this `stat`.
40
44
  """
41
45
 
42
46
  _aesthetics_doc = """
@@ -26,6 +26,10 @@ class stat_hull(stat):
26
26
  Raised when Qhull encounters an error condition,
27
27
  such as geometrical degeneracy when options to resolve are
28
28
  not enabled.
29
+
30
+ See Also
31
+ --------
32
+ plotnine.geom_path : The default `geom` for this `stat`.
29
33
  """
30
34
 
31
35
  _aesthetics_doc = """
@@ -12,6 +12,10 @@ class stat_identity(stat):
12
12
  Parameters
13
13
  ----------
14
14
  {common_parameters}
15
+
16
+ See Also
17
+ --------
18
+ plotnine.geom_point : The default `geom` for this `stat`.
15
19
  """
16
20
 
17
21
  DEFAULT_PARAMS = {"geom": "point", "position": "identity", "na_rm": False}
@@ -24,6 +24,7 @@ class stat_pointdensity(stat):
24
24
 
25
25
  See Also
26
26
  --------
27
+ plotnine.geom_density_2d : The default `geom` for this `stat`.
27
28
  statsmodels.nonparametric.kde.KDEMultivariate
28
29
  scipy.stats.gaussian_kde
29
30
  sklearn.neighbors.KernelDensity
plotnine/stats/stat_qq.py CHANGED
@@ -47,6 +47,7 @@ class stat_qq(stat):
47
47
 
48
48
  See Also
49
49
  --------
50
+ plotnine.geom_qq : The default `geom` for this `stat`.
50
51
  scipy.stats.mstats.plotting_positions : Uses `alpha_beta`
51
52
  to calculate the quantiles.
52
53
  """
@@ -41,6 +41,7 @@ class stat_qq_line(stat):
41
41
 
42
42
  See Also
43
43
  --------
44
+ plotnine.geom_qq_line : The default `geom` for this `stat`.
44
45
  scipy.stats.mstats.plotting_positions : Uses `alpha_beta`
45
46
  to calculate the quantiles.
46
47
  """
@@ -29,8 +29,8 @@ class stat_quantile(stat):
29
29
 
30
30
  See Also
31
31
  --------
32
+ plotnine.geom_quantile : The default `geom` for this `stat`.
32
33
  statsmodels.regression.quantile_regression.QuantReg
33
- plotnine.geom_quantile
34
34
  """
35
35
 
36
36
  _aesthetics_doc = """
@@ -69,7 +69,7 @@ class stat_sina(stat):
69
69
 
70
70
  See Also
71
71
  --------
72
- plotnine.geom_sina
72
+ plotnine.geom_sina : The default `geom` for this `stat`.
73
73
  """
74
74
 
75
75
  _aesthetics_doc = """
@@ -106,6 +106,7 @@ class stat_smooth(stat):
106
106
 
107
107
  See Also
108
108
  --------
109
+ plotnine.geom_smooth : The default `geom` for this `stat`.
109
110
  statsmodels.regression.linear_model.OLS
110
111
  statsmodels.regression.linear_model.WLS
111
112
  statsmodels.robust.robust_linear_model.RLM
@@ -17,6 +17,10 @@ class stat_sum(stat):
17
17
  Parameters
18
18
  ----------
19
19
  {common_parameters}
20
+
21
+ See Also
22
+ --------
23
+ plotnine.geom_point : The default `geom` for this `stat`.
20
24
  """
21
25
 
22
26
  _aesthetics_doc = """
@@ -247,7 +247,7 @@ class stat_summary(stat):
247
247
 
248
248
  See Also
249
249
  --------
250
- plotnine.geom_pointrange
250
+ plotnine.geom_pointrange : The default `geom` for this `stat`.
251
251
  """
252
252
 
253
253
  _aesthetics_doc = """
@@ -63,7 +63,7 @@ class stat_summary_bin(stat):
63
63
 
64
64
  See Also
65
65
  --------
66
- plotnine.geom_pointrange
66
+ plotnine.geom_pointrange : The default `geom` for this `stat`.
67
67
  """
68
68
 
69
69
  _aesthetics_doc = """
@@ -12,6 +12,10 @@ class stat_unique(stat):
12
12
  Parameters
13
13
  ----------
14
14
  {common_parameters}
15
+
16
+ See Also
17
+ --------
18
+ plotnine.geom_point : The default `geom` for this `stat`.
15
19
  """
16
20
 
17
21
  DEFAULT_PARAMS = {"geom": "point", "position": "identity", "na_rm": False}
@@ -69,7 +69,7 @@ class stat_ydensity(stat):
69
69
 
70
70
  See Also
71
71
  --------
72
- plotnine.geom_violin
72
+ plotnine.geom_violin : The default `geom` for this `stat`.
73
73
  statsmodels.nonparametric.kde.KDEUnivariate
74
74
  statsmodels.nonparametric.kde.KDEUnivariate.fit
75
75
  """
plotnine/themes/theme.py CHANGED
@@ -72,7 +72,7 @@ class theme:
72
72
  ```
73
73
 
74
74
  will only modify the x-axis text.
75
- kwargs: dict
75
+ kwargs: Any
76
76
  kwargs are `themeables`. The themeables are elements that are
77
77
  subclasses of `themeable`. Many themeables are defined using
78
78
  theme elements i.e
@@ -25,7 +25,6 @@ class theme_void(theme):
25
25
 
26
26
  def __init__(self, base_size=11, base_family=None):
27
27
  base_family = base_family or get_option("base_family")
28
- half_line = base_size / 2
29
28
  m = get_option("base_margin")
30
29
  # Use only inherited elements and make everything blank
31
30
  theme.__init__(
@@ -98,11 +97,6 @@ class theme_void(theme):
98
97
  plot_tag_location="margin",
99
98
  plot_tag_position="topleft",
100
99
  strip_align=0,
101
- strip_text=element_text(
102
- color="#1A1A1A",
103
- size=base_size * 0.8,
104
- linespacing=1.5,
105
- margin=margin_auto(half_line * 0.8),
106
- ),
100
+ strip_text=element_text(size=base_size * 0.8),
107
101
  complete=True,
108
102
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotnine
3
- Version: 0.15.0a6
3
+ Version: 0.15.0a8
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)