plotnine 0.15.0.dev3__py3-none-any.whl → 0.15.2__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 (139) hide show
  1. plotnine/__init__.py +2 -0
  2. plotnine/_mpl/layout_manager/_engine.py +1 -1
  3. plotnine/_mpl/layout_manager/_layout_items.py +126 -41
  4. plotnine/_mpl/layout_manager/_layout_tree.py +712 -314
  5. plotnine/_mpl/layout_manager/_spaces.py +305 -101
  6. plotnine/_mpl/patches.py +70 -34
  7. plotnine/_mpl/text.py +144 -63
  8. plotnine/_mpl/utils.py +1 -1
  9. plotnine/_utils/__init__.py +50 -107
  10. plotnine/_utils/context.py +78 -2
  11. plotnine/_utils/ipython.py +35 -51
  12. plotnine/_utils/quarto.py +26 -0
  13. plotnine/_utils/yippie.py +115 -0
  14. plotnine/composition/__init__.py +11 -0
  15. plotnine/composition/_beside.py +55 -0
  16. plotnine/composition/_compose.py +471 -0
  17. plotnine/composition/_plot_spacer.py +60 -0
  18. plotnine/composition/_stack.py +55 -0
  19. plotnine/coords/coord.py +3 -3
  20. plotnine/data/__init__.py +31 -0
  21. plotnine/data/anscombe-quartet.csv +45 -0
  22. plotnine/doctools.py +4 -4
  23. plotnine/facets/facet.py +4 -4
  24. plotnine/facets/strips.py +17 -28
  25. plotnine/geoms/annotate.py +13 -13
  26. plotnine/geoms/annotation_logticks.py +7 -8
  27. plotnine/geoms/annotation_stripes.py +6 -6
  28. plotnine/geoms/geom.py +60 -27
  29. plotnine/geoms/geom_abline.py +3 -2
  30. plotnine/geoms/geom_area.py +2 -2
  31. plotnine/geoms/geom_bar.py +1 -0
  32. plotnine/geoms/geom_bin_2d.py +6 -2
  33. plotnine/geoms/geom_blank.py +0 -3
  34. plotnine/geoms/geom_boxplot.py +8 -4
  35. plotnine/geoms/geom_col.py +2 -2
  36. plotnine/geoms/geom_count.py +6 -2
  37. plotnine/geoms/geom_crossbar.py +3 -3
  38. plotnine/geoms/geom_density_2d.py +6 -2
  39. plotnine/geoms/geom_dotplot.py +2 -2
  40. plotnine/geoms/geom_errorbar.py +2 -2
  41. plotnine/geoms/geom_errorbarh.py +2 -2
  42. plotnine/geoms/geom_histogram.py +1 -1
  43. plotnine/geoms/geom_hline.py +3 -2
  44. plotnine/geoms/geom_linerange.py +2 -2
  45. plotnine/geoms/geom_map.py +5 -5
  46. plotnine/geoms/geom_path.py +11 -12
  47. plotnine/geoms/geom_point.py +4 -5
  48. plotnine/geoms/geom_pointdensity.py +4 -0
  49. plotnine/geoms/geom_pointrange.py +3 -5
  50. plotnine/geoms/geom_polygon.py +2 -3
  51. plotnine/geoms/geom_qq.py +4 -0
  52. plotnine/geoms/geom_qq_line.py +4 -0
  53. plotnine/geoms/geom_quantile.py +4 -0
  54. plotnine/geoms/geom_raster.py +4 -5
  55. plotnine/geoms/geom_rect.py +3 -4
  56. plotnine/geoms/geom_ribbon.py +7 -7
  57. plotnine/geoms/geom_rug.py +1 -1
  58. plotnine/geoms/geom_segment.py +2 -2
  59. plotnine/geoms/geom_sina.py +3 -3
  60. plotnine/geoms/geom_smooth.py +7 -3
  61. plotnine/geoms/geom_step.py +2 -2
  62. plotnine/geoms/geom_text.py +2 -3
  63. plotnine/geoms/geom_violin.py +8 -5
  64. plotnine/geoms/geom_vline.py +3 -2
  65. plotnine/ggplot.py +64 -85
  66. plotnine/guides/guide.py +7 -10
  67. plotnine/guides/guide_colorbar.py +3 -3
  68. plotnine/guides/guide_legend.py +3 -3
  69. plotnine/guides/guides.py +6 -6
  70. plotnine/helpers.py +49 -0
  71. plotnine/iapi.py +28 -5
  72. plotnine/labels.py +3 -3
  73. plotnine/layer.py +36 -19
  74. plotnine/mapping/_atomic.py +178 -0
  75. plotnine/mapping/_env.py +13 -2
  76. plotnine/mapping/_eval_environment.py +1 -1
  77. plotnine/mapping/aes.py +85 -49
  78. plotnine/scales/__init__.py +2 -0
  79. plotnine/scales/limits.py +7 -7
  80. plotnine/scales/scale.py +3 -3
  81. plotnine/scales/scale_color.py +82 -18
  82. plotnine/scales/scale_continuous.py +6 -4
  83. plotnine/scales/scale_datetime.py +28 -14
  84. plotnine/scales/scale_discrete.py +1 -1
  85. plotnine/scales/scale_identity.py +21 -2
  86. plotnine/scales/scale_manual.py +8 -2
  87. plotnine/scales/scale_xy.py +2 -2
  88. plotnine/stats/binning.py +4 -1
  89. plotnine/stats/smoothers.py +23 -36
  90. plotnine/stats/stat.py +20 -32
  91. plotnine/stats/stat_bin.py +6 -5
  92. plotnine/stats/stat_bin_2d.py +11 -9
  93. plotnine/stats/stat_bindot.py +13 -16
  94. plotnine/stats/stat_boxplot.py +6 -6
  95. plotnine/stats/stat_count.py +6 -9
  96. plotnine/stats/stat_density.py +7 -10
  97. plotnine/stats/stat_density_2d.py +12 -8
  98. plotnine/stats/stat_ecdf.py +7 -6
  99. plotnine/stats/stat_ellipse.py +9 -6
  100. plotnine/stats/stat_function.py +10 -8
  101. plotnine/stats/stat_hull.py +6 -3
  102. plotnine/stats/stat_identity.py +5 -2
  103. plotnine/stats/stat_pointdensity.py +5 -7
  104. plotnine/stats/stat_qq.py +46 -20
  105. plotnine/stats/stat_qq_line.py +16 -11
  106. plotnine/stats/stat_quantile.py +15 -9
  107. plotnine/stats/stat_sina.py +13 -15
  108. plotnine/stats/stat_smooth.py +8 -10
  109. plotnine/stats/stat_sum.py +5 -2
  110. plotnine/stats/stat_summary.py +7 -10
  111. plotnine/stats/stat_summary_bin.py +11 -14
  112. plotnine/stats/stat_unique.py +5 -2
  113. plotnine/stats/stat_ydensity.py +8 -11
  114. plotnine/themes/elements/__init__.py +2 -1
  115. plotnine/themes/elements/element_line.py +17 -9
  116. plotnine/themes/elements/margin.py +64 -1
  117. plotnine/themes/theme.py +9 -1
  118. plotnine/themes/theme_538.py +0 -1
  119. plotnine/themes/theme_bw.py +0 -1
  120. plotnine/themes/theme_dark.py +0 -1
  121. plotnine/themes/theme_gray.py +6 -5
  122. plotnine/themes/theme_light.py +1 -1
  123. plotnine/themes/theme_matplotlib.py +5 -5
  124. plotnine/themes/theme_seaborn.py +7 -4
  125. plotnine/themes/theme_void.py +9 -8
  126. plotnine/themes/theme_xkcd.py +0 -1
  127. plotnine/themes/themeable.py +109 -31
  128. plotnine/typing.py +17 -6
  129. plotnine/watermark.py +3 -3
  130. {plotnine-0.15.0.dev3.dist-info → plotnine-0.15.2.dist-info}/METADATA +13 -6
  131. plotnine-0.15.2.dist-info/RECORD +221 -0
  132. {plotnine-0.15.0.dev3.dist-info → plotnine-0.15.2.dist-info}/WHEEL +1 -1
  133. plotnine/plot_composition/__init__.py +0 -10
  134. plotnine/plot_composition/_compose.py +0 -436
  135. plotnine/plot_composition/_spacer.py +0 -32
  136. plotnine-0.15.0.dev3.dist-info/RECORD +0 -215
  137. /plotnine/{plot_composition → composition}/_plotspec.py +0 -0
  138. {plotnine-0.15.0.dev3.dist-info → plotnine-0.15.2.dist-info}/licenses/LICENSE +0 -0
  139. {plotnine-0.15.0.dev3.dist-info → plotnine-0.15.2.dist-info}/top_level.txt +0 -0
@@ -67,7 +67,7 @@ class geom_errorbar(geom):
67
67
  panel_params: panel_view,
68
68
  coord: coord,
69
69
  ax: Axes,
70
- **params: Any,
70
+ params: dict[str, Any],
71
71
  ):
72
72
  f = np.hstack
73
73
  # create (two horizontal bars) + vertical bar
@@ -81,4 +81,4 @@ class geom_errorbar(geom):
81
81
  )
82
82
 
83
83
  copy_missing_columns(bars, data)
84
- geom_segment.draw_group(bars, panel_params, coord, ax, **params)
84
+ geom_segment.draw_group(bars, panel_params, coord, ax, params)
@@ -67,7 +67,7 @@ class geom_errorbarh(geom):
67
67
  panel_params: panel_view,
68
68
  coord: coord,
69
69
  ax: Axes,
70
- **params: Any,
70
+ params: dict[str, Any],
71
71
  ):
72
72
  f = np.hstack
73
73
  # create (two vertical bars) + horizontal bar
@@ -81,4 +81,4 @@ class geom_errorbarh(geom):
81
81
  )
82
82
 
83
83
  copy_missing_columns(bars, data)
84
- geom_segment.draw_group(bars, panel_params, coord, ax, **params)
84
+ geom_segment.draw_group(bars, panel_params, coord, ax, params)
@@ -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}
@@ -80,7 +80,6 @@ class geom_hline(geom):
80
80
  panel_params: panel_view,
81
81
  coord: coord,
82
82
  ax: Axes,
83
- **params: Any,
84
83
  ):
85
84
  """
86
85
  Plot all groups
@@ -94,4 +93,6 @@ class geom_hline(geom):
94
93
 
95
94
  for _, gdata in data.groupby("group"):
96
95
  gdata.reset_index(inplace=True)
97
- geom_segment.draw_group(gdata, panel_params, coord, ax, **params)
96
+ geom_segment.draw_group(
97
+ gdata, panel_params, coord, ax, self.params
98
+ )
@@ -49,7 +49,7 @@ class geom_linerange(geom):
49
49
  panel_params: panel_view,
50
50
  coord: coord,
51
51
  ax: Axes,
52
- **params: Any,
52
+ params: dict[str, Any],
53
53
  ):
54
54
  data.eval(
55
55
  """
@@ -59,4 +59,4 @@ class geom_linerange(geom):
59
59
  """,
60
60
  inplace=True,
61
61
  )
62
- geom_segment.draw_group(data, panel_params, coord, ax, **params)
62
+ geom_segment.draw_group(data, panel_params, coord, ax, params)
@@ -33,10 +33,10 @@ class geom_map(geom):
33
33
  """
34
34
  Draw map feature
35
35
 
36
- The map feature are drawn without any special projections.
37
-
38
36
  {usage}
39
37
 
38
+ The map feature are drawn without any special projections.
39
+
40
40
  Parameters
41
41
  ----------
42
42
  {common_parameters}
@@ -119,11 +119,11 @@ class geom_map(geom):
119
119
  panel_params: panel_view,
120
120
  coord: coord,
121
121
  ax: Axes,
122
- **params: Any,
123
122
  ):
124
123
  if not len(data):
125
124
  return
126
125
 
126
+ params = self.params
127
127
  data.loc[data["color"].isna(), "color"] = "none"
128
128
  data.loc[data["fill"].isna(), "fill"] = "none"
129
129
  data["fill"] = to_rgba(data["fill"], data["alpha"])
@@ -153,7 +153,7 @@ class geom_map(geom):
153
153
  for _, gdata in data.groupby("group"):
154
154
  gdata.reset_index(inplace=True, drop=True)
155
155
  gdata.is_copy = None
156
- geom_point.draw_group(gdata, panel_params, coord, ax, **params)
156
+ geom_point.draw_group(gdata, panel_params, coord, ax, params)
157
157
  elif geom_type == "MultiPoint":
158
158
  # Where n is the length of the dataframe (no. of multipoints),
159
159
  # m is the number of all points in all multipoints
@@ -168,7 +168,7 @@ class geom_map(geom):
168
168
  data = data.explode("points", ignore_index=True)
169
169
  data["x"] = [p[0] for p in data["points"]]
170
170
  data["y"] = [p[1] for p in data["points"]]
171
- geom_point.draw_group(data, panel_params, coord, ax, **params)
171
+ geom_point.draw_group(data, panel_params, coord, ax, params)
172
172
  elif geom_type in ("LineString", "MultiLineString"):
173
173
  from matplotlib.collections import LineCollection
174
174
 
@@ -107,7 +107,6 @@ class geom_path(geom):
107
107
  panel_params: panel_view,
108
108
  coord: coord,
109
109
  ax: Axes,
110
- **params: Any,
111
110
  ):
112
111
  if not any(data["group"].duplicated()):
113
112
  warn(
@@ -138,14 +137,14 @@ class geom_path(geom):
138
137
  ngroup = len(np.unique(data["group"].to_numpy()))
139
138
 
140
139
  constant = num_unique_rows == ngroup
141
- params["constant"] = constant
140
+ self.params["constant"] = constant
142
141
 
143
142
  if not constant:
144
- self.draw_group(data, panel_params, coord, ax, **params)
143
+ self.draw_group(data, panel_params, coord, ax, self.params)
145
144
  else:
146
145
  for _, gdata in data.groupby("group"):
147
146
  gdata.reset_index(inplace=True, drop=True)
148
- self.draw_group(gdata, panel_params, coord, ax, **params)
147
+ self.draw_group(gdata, panel_params, coord, ax, self.params)
149
148
 
150
149
  @staticmethod
151
150
  def draw_group(
@@ -153,7 +152,7 @@ class geom_path(geom):
153
152
  panel_params: panel_view,
154
153
  coord: coord,
155
154
  ax: Axes,
156
- **params: Any,
155
+ params: dict[str, Any],
157
156
  ):
158
157
  data = coord.transform(data, panel_params, munch=True)
159
158
  data["linewidth"] = data["size"] * SIZE_FACTOR
@@ -164,13 +163,13 @@ class geom_path(geom):
164
163
  constant = len(np.unique(data["group"].to_numpy())) == 1
165
164
 
166
165
  if not constant:
167
- _draw_segments(data, ax, **params)
166
+ _draw_segments(data, ax, params)
168
167
  else:
169
- _draw_lines(data, ax, **params)
168
+ _draw_lines(data, ax, params)
170
169
 
171
170
  if "arrow" in params and params["arrow"]:
172
171
  params["arrow"].draw(
173
- data, panel_params, coord, ax, constant=constant, **params
172
+ data, panel_params, coord, ax, params, constant=constant
174
173
  )
175
174
 
176
175
  @staticmethod
@@ -264,8 +263,8 @@ class arrow:
264
263
  panel_params: panel_view,
265
264
  coord: coord,
266
265
  ax: Axes,
266
+ params: dict[str, Any],
267
267
  constant: bool = True,
268
- **params: Any,
269
268
  ):
270
269
  """
271
270
  Draw arrows at the end(s) of the lines
@@ -454,7 +453,7 @@ class arrow:
454
453
  return paths
455
454
 
456
455
 
457
- def _draw_segments(data: pd.DataFrame, ax: Axes, **params: Any):
456
+ def _draw_segments(data: pd.DataFrame, ax: Axes, params: dict[str, Any]):
458
457
  """
459
458
  Draw independent line segments between all the
460
459
  points
@@ -482,7 +481,7 @@ def _draw_segments(data: pd.DataFrame, ax: Axes, **params: Any):
482
481
  linestyle = data.loc[indices, "linetype"]
483
482
 
484
483
  coll = LineCollection(
485
- segments, # pyright: ignore[reportArgumentType]
484
+ segments,
486
485
  edgecolor=edgecolor,
487
486
  linewidth=linewidth,
488
487
  linestyle=linestyle,
@@ -493,7 +492,7 @@ def _draw_segments(data: pd.DataFrame, ax: Axes, **params: Any):
493
492
  ax.add_collection(coll)
494
493
 
495
494
 
496
- def _draw_lines(data: pd.DataFrame, ax: Axes, **params: Any):
495
+ def _draw_lines(data: pd.DataFrame, ax: Axes, params: dict[str, Any]):
497
496
  """
498
497
  Draw a path with the same characteristics from the
499
498
  first point to the last point
@@ -55,12 +55,11 @@ class geom_point(geom):
55
55
  panel_params: panel_view,
56
56
  coord: coord,
57
57
  ax: Axes,
58
- **params: Any,
59
58
  ):
60
59
  """
61
60
  Plot all groups
62
61
  """
63
- self.draw_group(data, panel_params, coord, ax, **params)
62
+ self.draw_group(data, panel_params, coord, ax, self.params)
64
63
 
65
64
  @staticmethod
66
65
  def draw_group(
@@ -68,13 +67,13 @@ class geom_point(geom):
68
67
  panel_params: panel_view,
69
68
  coord: coord,
70
69
  ax: Axes,
71
- **params: Any,
70
+ params: dict[str, Any],
72
71
  ):
73
72
  data = coord.transform(data, panel_params)
74
73
  units = "shape"
75
74
  for _, udata in data.groupby(units, dropna=False):
76
75
  udata.reset_index(inplace=True, drop=True)
77
- geom_point.draw_unit(udata, panel_params, coord, ax, **params)
76
+ geom_point.draw_unit(udata, panel_params, coord, ax, params)
78
77
 
79
78
  @staticmethod
80
79
  def draw_unit(
@@ -82,7 +81,7 @@ class geom_point(geom):
82
81
  panel_params: panel_view,
83
82
  coord: coord,
84
83
  ax: Axes,
85
- **params: Any,
84
+ params: dict[str, Any],
86
85
  ):
87
86
  # Our size is in 'points' while scatter wants
88
87
  # 'points^2'. The stroke is outside. And pi
@@ -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 = {
@@ -58,14 +58,12 @@ class geom_pointrange(geom):
58
58
  panel_params: panel_view,
59
59
  coord: coord,
60
60
  ax: Axes,
61
- **params: Any,
61
+ params: dict[str, Any],
62
62
  ):
63
- geom_linerange.draw_group(
64
- data.copy(), panel_params, coord, ax, **params
65
- )
63
+ geom_linerange.draw_group(data.copy(), panel_params, coord, ax, params)
66
64
  data["size"] = data["size"] * params["fatten"]
67
65
  data["stroke"] = geom_point.DEFAULT_AES["stroke"]
68
- geom_point.draw_group(data, panel_params, coord, ax, **params)
66
+ geom_point.draw_group(data, panel_params, coord, ax, params)
69
67
 
70
68
  @staticmethod
71
69
  def draw_legend(
@@ -62,12 +62,11 @@ class geom_polygon(geom):
62
62
  panel_params: panel_view,
63
63
  coord: coord,
64
64
  ax: Axes,
65
- **params: Any,
66
65
  ):
67
66
  """
68
67
  Plot all groups
69
68
  """
70
- self.draw_group(data, panel_params, coord, ax, **params)
69
+ self.draw_group(data, panel_params, coord, ax, self.params)
71
70
 
72
71
  @staticmethod
73
72
  def draw_group(
@@ -75,7 +74,7 @@ class geom_polygon(geom):
75
74
  panel_params: panel_view,
76
75
  coord: coord,
77
76
  ax: Axes,
78
- **params: Any,
77
+ params: dict[str, Any],
79
78
  ):
80
79
  from matplotlib.collections import PolyCollection
81
80
 
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 = {
@@ -155,7 +155,6 @@ class geom_raster(geom):
155
155
  panel_params: panel_view,
156
156
  coord: coord,
157
157
  ax: Axes,
158
- **params: Any,
159
158
  ):
160
159
  """
161
160
  Plot all groups
@@ -194,7 +193,7 @@ class geom_raster(geom):
194
193
  im = AxesImage(
195
194
  ax,
196
195
  data=X,
197
- interpolation=params["interpolation"],
196
+ interpolation=self.params["interpolation"],
198
197
  origin="upper",
199
198
  extent=(
200
199
  data["xmin"].min(),
@@ -202,8 +201,8 @@ class geom_raster(geom):
202
201
  data["ymin"].min(),
203
202
  data["ymax"].max(),
204
203
  ),
205
- rasterized=params["raster"],
206
- filterrad=params["filterrad"],
207
- zorder=params["zorder"],
204
+ rasterized=self.params["raster"],
205
+ filterrad=self.params["filterrad"],
206
+ zorder=self.params["zorder"],
208
207
  )
209
208
  ax.add_image(im)
@@ -52,7 +52,6 @@ class geom_rect(geom):
52
52
  panel_params: panel_view,
53
53
  coord: coord,
54
54
  ax: Axes,
55
- **params: Any,
56
55
  ):
57
56
  """
58
57
  Plot all groups
@@ -62,10 +61,10 @@ class geom_rect(geom):
62
61
  for _, gdata in data.groupby("group"):
63
62
  gdata.reset_index(inplace=True, drop=True)
64
63
  geom_polygon.draw_group(
65
- gdata, panel_params, coord, ax, **params
64
+ gdata, panel_params, coord, ax, self.params
66
65
  )
67
66
  else:
68
- self.draw_group(data, panel_params, coord, ax, **params)
67
+ self.draw_group(data, panel_params, coord, ax, self.params)
69
68
 
70
69
  @staticmethod
71
70
  def draw_group(
@@ -73,7 +72,7 @@ class geom_rect(geom):
73
72
  panel_params: panel_view,
74
73
  coord: coord,
75
74
  ax: Axes,
76
- **params: Any,
75
+ params: dict[str, Any],
77
76
  ):
78
77
  from matplotlib.collections import PolyCollection
79
78
 
@@ -94,7 +94,7 @@ class geom_ribbon(geom):
94
94
  panel_params: panel_view,
95
95
  coord: coord,
96
96
  ax: Axes,
97
- **params: Any,
97
+ params: dict[str, Any],
98
98
  ):
99
99
  _x = "y" if isinstance(coord, coord_flip) else "x"
100
100
  data = coord.transform(data, panel_params, munch=True)
@@ -107,7 +107,7 @@ class geom_ribbon(geom):
107
107
 
108
108
  for _, udata in data.groupby(units, dropna=False):
109
109
  udata.reset_index(inplace=True, drop=True)
110
- geom_ribbon.draw_unit(udata, panel_params, coord, ax, **params)
110
+ geom_ribbon.draw_unit(udata, panel_params, coord, ax, params)
111
111
 
112
112
  @staticmethod
113
113
  def draw_unit(
@@ -115,7 +115,7 @@ class geom_ribbon(geom):
115
115
  panel_params: panel_view,
116
116
  coord: coord,
117
117
  ax: Axes,
118
- **params: Any,
118
+ params: dict[str, Any],
119
119
  ):
120
120
  linewidth = data["size"].iloc[0] * SIZE_FACTOR
121
121
  fill = to_rgba(data["fill"], data["alpha"])
@@ -159,7 +159,7 @@ class geom_ribbon(geom):
159
159
 
160
160
  # Alpha does not affect the outlines
161
161
  data["alpha"] = 1
162
- geom_ribbon._draw_outline(data, panel_params, coord, ax, **params)
162
+ geom_ribbon._draw_outline(data, panel_params, coord, ax, params)
163
163
 
164
164
  @staticmethod
165
165
  def _draw_outline(
@@ -167,7 +167,7 @@ class geom_ribbon(geom):
167
167
  panel_params: panel_view,
168
168
  coord: coord,
169
169
  ax: Axes,
170
- **params: Any,
170
+ params: dict[str, Any],
171
171
  ):
172
172
  outline_type = params["outline_type"]
173
173
 
@@ -185,7 +185,7 @@ class geom_ribbon(geom):
185
185
  panel_params,
186
186
  coord,
187
187
  ax,
188
- **params,
188
+ params,
189
189
  )
190
190
 
191
191
  if outline_type in ("upper", "both"):
@@ -194,5 +194,5 @@ class geom_ribbon(geom):
194
194
  panel_params,
195
195
  coord,
196
196
  ax,
197
- **params,
197
+ params,
198
198
  )
@@ -60,7 +60,7 @@ class geom_rug(geom):
60
60
  panel_params: panel_view,
61
61
  coord: coord,
62
62
  ax: Axes,
63
- **params: Any,
63
+ params: dict[str, Any],
64
64
  ):
65
65
  from matplotlib.collections import LineCollection
66
66
 
@@ -64,7 +64,7 @@ class geom_segment(geom):
64
64
  panel_params: panel_view,
65
65
  coord: coord,
66
66
  ax: Axes,
67
- **params: Any,
67
+ params: dict[str, Any],
68
68
  ):
69
69
  from matplotlib.collections import LineCollection
70
70
 
@@ -100,5 +100,5 @@ class geom_segment(geom):
100
100
  adata[param] = np.hstack([data[param], data[param]])
101
101
 
102
102
  params["arrow"].draw(
103
- adata, panel_params, coord, ax, constant=False, **params
103
+ adata, panel_params, coord, ax, params, constant=False
104
104
  )
@@ -7,20 +7,20 @@ class geom_sina(geom_point):
7
7
  """
8
8
  Draw a sina plot
9
9
 
10
+ {usage}
11
+
10
12
  A sina plot is a data visualization chart suitable for plotting
11
13
  any single variable in a multiclass dataset. It is an enhanced
12
14
  jitter strip chart, where the width of the jitter is controlled
13
15
  by the density distribution of the data within each class.
14
16
 
15
- {usage}
16
-
17
17
  Parameters
18
18
  ----------
19
19
  {common_parameters}
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 = {
@@ -78,7 +82,7 @@ class geom_smooth(geom):
78
82
  panel_params: panel_view,
79
83
  coord: coord,
80
84
  ax: Axes,
81
- **params: Any,
85
+ params: dict[str, Any],
82
86
  ):
83
87
  has_ribbon = "ymin" in data and "ymax" in data
84
88
  if has_ribbon:
@@ -86,10 +90,10 @@ class geom_smooth(geom):
86
90
  data2["color"] = "none"
87
91
  params2 = params.copy()
88
92
  params2["outline_type"] = "full"
89
- geom_ribbon.draw_group(data2, panel_params, coord, ax, **params2)
93
+ geom_ribbon.draw_group(data2, panel_params, coord, ax, params2)
90
94
 
91
95
  data["alpha"] = 1
92
- geom_line.draw_group(data, panel_params, coord, ax, **params)
96
+ geom_line.draw_group(data, panel_params, coord, ax, params)
93
97
 
94
98
  @staticmethod
95
99
  def draw_legend(
@@ -54,7 +54,7 @@ class geom_step(geom_path):
54
54
  panel_params: panel_view,
55
55
  coord: coord,
56
56
  ax: Axes,
57
- **params: Any,
57
+ params: dict[str, Any],
58
58
  ):
59
59
  direction = params["direction"]
60
60
  n = len(data)
@@ -84,4 +84,4 @@ class geom_step(geom_path):
84
84
 
85
85
  path_data = pd.DataFrame({"x": new_x, "y": new_y})
86
86
  copy_missing_columns(path_data, data)
87
- geom_path.draw_group(path_data, panel_params, coord, ax, **params)
87
+ geom_path.draw_group(path_data, panel_params, coord, ax, params)
@@ -214,9 +214,8 @@ class geom_text(geom):
214
214
  panel_params: panel_view,
215
215
  coord: coord,
216
216
  ax: Axes,
217
- **params: Any,
218
217
  ):
219
- super().draw_panel(data, panel_params, coord, ax, **params)
218
+ super().draw_panel(data, panel_params, coord, ax)
220
219
 
221
220
  @staticmethod
222
221
  def draw_group(
@@ -224,7 +223,7 @@ class geom_text(geom):
224
223
  panel_params: panel_view,
225
224
  coord: coord,
226
225
  ax: Axes,
227
- **params: Any,
226
+ params: dict[str, Any],
228
227
  ):
229
228
  data = coord.transform(data, panel_params)
230
229
  zorder = params["zorder"]
@@ -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 = {
@@ -113,8 +117,8 @@ class geom_violin(geom):
113
117
  panel_params: panel_view,
114
118
  coord: coord,
115
119
  ax: Axes,
116
- **params: Any,
117
120
  ):
121
+ params = self.params.copy()
118
122
  quantiles = params.pop("draw_quantiles")
119
123
  style = params.pop("style")
120
124
  zorder = params.pop("zorder")
@@ -125,6 +129,7 @@ class geom_violin(geom):
125
129
  # in the range [zorder, zorder + 1) to stay within the layer.
126
130
  group = cast("int", group)
127
131
  group_zorder = zorder + 0.9 / group
132
+ params["zorder"] = group_zorder
128
133
 
129
134
  # Find the points for the line to go all the way around
130
135
  df["xminv"] = df["x"] - df["violinwidth"] * (df["x"] - df["xmin"])
@@ -167,8 +172,7 @@ class geom_violin(geom):
167
172
  panel_params,
168
173
  coord,
169
174
  ax,
170
- zorder=group_zorder,
171
- **params,
175
+ params,
172
176
  )
173
177
 
174
178
  if quantiles is not None:
@@ -190,8 +194,7 @@ class geom_violin(geom):
190
194
  panel_params,
191
195
  coord,
192
196
  ax,
193
- zorder=group_zorder,
194
- **params,
197
+ params,
195
198
  )
196
199
 
197
200
 
@@ -80,7 +80,6 @@ class geom_vline(geom):
80
80
  panel_params: panel_view,
81
81
  coord: coord,
82
82
  ax: Axes,
83
- **params: Any,
84
83
  ):
85
84
  """
86
85
  Plot all groups
@@ -94,7 +93,9 @@ class geom_vline(geom):
94
93
 
95
94
  for _, gdata in data.groupby("group"):
96
95
  gdata.reset_index(inplace=True)
97
- geom_segment.draw_group(gdata, panel_params, coord, ax, **params)
96
+ geom_segment.draw_group(
97
+ gdata, panel_params, coord, ax, self.params
98
+ )
98
99
 
99
100
  @staticmethod
100
101
  def draw_legend(