@@ -149,11 +149,13 @@ def line(self, x: str, y: Union[str, list[str]], **kwargs: Any) -> "Figure":
149
149
150
150
Examples
151
151
--------
152
- >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
153
- >>> columns = ["category", "int_val", "float_val"]
154
- >>> df = spark.createDataFrame(data, columns)
155
- >>> df.plot.line(x="category", y="int_val") # doctest: +SKIP
156
- >>> df.plot.line(x="category", y=["int_val", "float_val"]) # doctest: +SKIP
152
+ .. plotly::
153
+
154
+ >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
155
+ >>> columns = ["category", "int_val", "float_val"]
156
+ >>> df = spark.createDataFrame(data, columns)
157
+ >>> df.plot.line(x="category", y="int_val") # doctest: +SKIP
158
+ >>> df.plot.line(x="category", y=["int_val", "float_val"]) # doctest: +SKIP
157
159
"""
158
160
return self (kind = "line" , x = x , y = y , ** kwargs )
159
161
@@ -182,11 +184,13 @@ def bar(self, x: str, y: Union[str, list[str]], **kwargs: Any) -> "Figure":
182
184
183
185
Examples
184
186
--------
185
- >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
186
- >>> columns = ["category", "int_val", "float_val"]
187
- >>> df = spark.createDataFrame(data, columns)
188
- >>> df.plot.bar(x="category", y="int_val") # doctest: +SKIP
189
- >>> df.plot.bar(x="category", y=["int_val", "float_val"]) # doctest: +SKIP
187
+ .. plotly::
188
+
189
+ >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
190
+ >>> columns = ["category", "int_val", "float_val"]
191
+ >>> df = spark.createDataFrame(data, columns)
192
+ >>> df.plot.bar(x="category", y="int_val") # doctest: +SKIP
193
+ >>> df.plot.bar(x="category", y=["int_val", "float_val"]) # doctest: +SKIP
190
194
"""
191
195
return self (kind = "bar" , x = x , y = y , ** kwargs )
192
196
@@ -224,13 +228,15 @@ def barh(self, x: str, y: Union[str, list[str]], **kwargs: Any) -> "Figure":
224
228
225
229
Examples
226
230
--------
227
- >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
228
- >>> columns = ["category", "int_val", "float_val"]
229
- >>> df = spark.createDataFrame(data, columns)
230
- >>> df.plot.barh(x="int_val", y="category") # doctest: +SKIP
231
- >>> df.plot.barh(
232
- ... x=["int_val", "float_val"], y="category"
233
- ... ) # doctest: +SKIP
231
+ .. plotly::
232
+
233
+ >>> data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
234
+ >>> columns = ["category", "int_val", "float_val"]
235
+ >>> df = spark.createDataFrame(data, columns)
236
+ >>> df.plot.barh(x="int_val", y="category") # doctest: +SKIP
237
+ >>> df.plot.barh(
238
+ ... x=["int_val", "float_val"], y="category"
239
+ ... ) # doctest: +SKIP
234
240
"""
235
241
return self (kind = "barh" , x = x , y = y , ** kwargs )
236
242
@@ -260,10 +266,12 @@ def scatter(self, x: str, y: str, **kwargs: Any) -> "Figure":
260
266
261
267
Examples
262
268
--------
263
- >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
264
- >>> columns = ['length', 'width', 'species']
265
- >>> df = spark.createDataFrame(data, columns)
266
- >>> df.plot.scatter(x='length', y='width') # doctest: +SKIP
269
+ .. plotly::
270
+
271
+ >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
272
+ >>> columns = ['length', 'width', 'species']
273
+ >>> df = spark.createDataFrame(data, columns)
274
+ >>> df.plot.scatter(x='length', y='width') # doctest: +SKIP
267
275
"""
268
276
return self (kind = "scatter" , x = x , y = y , ** kwargs )
269
277
@@ -288,16 +296,18 @@ def area(self, x: str, y: Union[str, list[str]], **kwargs: Any) -> "Figure":
288
296
289
297
Examples
290
298
--------
291
- >>> from datetime import datetime
292
- >>> data = [
293
- ... (3, 5, 20, datetime(2018, 1, 31)),
294
- ... (2, 5, 42, datetime(2018, 2, 28)),
295
- ... (3, 6, 28, datetime(2018, 3, 31)),
296
- ... (9, 12, 62, datetime(2018, 4, 30))
297
- ... ]
298
- >>> columns = ["sales", "#s", "visits", "date"]
299
- >>> df = spark.createDataFrame(data, columns)
300
- >>> df.plot.area(x='date', y=['sales', '#s', 'visits']) # doctest: +SKIP
299
+ .. plotly::
300
+
301
+ >>> from datetime import datetime
302
+ >>> data = [
303
+ ... (3, 5, 20, datetime(2018, 1, 31)),
304
+ ... (2, 5, 42, datetime(2018, 2, 28)),
305
+ ... (3, 6, 28, datetime(2018, 3, 31)),
306
+ ... (9, 12, 62, datetime(2018, 4, 30))
307
+ ... ]
308
+ >>> columns = ["sales", "#s", "visits", "date"]
309
+ >>> df = spark.createDataFrame(data, columns)
310
+ >>> df.plot.area(x='date', y=['sales', '#s', 'visits']) # doctest: +SKIP
301
311
"""
302
312
return self (kind = "area" , x = x , y = y , ** kwargs )
303
313
@@ -323,17 +333,19 @@ def pie(self, x: str, y: Optional[str], **kwargs: Any) -> "Figure":
323
333
324
334
Examples
325
335
--------
326
- >>> from datetime import datetime
327
- >>> data = [
328
- ... (3, 5, 20, datetime(2018, 1, 31)),
329
- ... (2, 5, 42, datetime(2018, 2, 28)),
330
- ... (3, 6, 28, datetime(2018, 3, 31)),
331
- ... (9, 12, 62, datetime(2018, 4, 30))
332
- ... ]
333
- >>> columns = ["sales", "#s", "visits", "date"]
334
- >>> df = spark.createDataFrame(data, columns)
335
- >>> df.plot.pie(x='date', y='sales') # doctest: +SKIP
336
- >>> df.plot.pie(x='date', subplots=True) # doctest: +SKIP
336
+ .. plotly::
337
+
338
+ >>> from datetime import datetime
339
+ >>> data = [
340
+ ... (3, 5, 20, datetime(2018, 1, 31)),
341
+ ... (2, 5, 42, datetime(2018, 2, 28)),
342
+ ... (3, 6, 28, datetime(2018, 3, 31)),
343
+ ... (9, 12, 62, datetime(2018, 4, 30))
344
+ ... ]
345
+ >>> columns = ["sales", "#s", "visits", "date"]
346
+ >>> df = spark.createDataFrame(data, columns)
347
+ >>> df.plot.pie(x='date', y='sales') # doctest: +SKIP
348
+ >>> df.plot.pie(x='date', subplots=True) # doctest: +SKIP
337
349
"""
338
350
return self (kind = "pie" , x = x , y = y , ** kwargs )
339
351
@@ -365,21 +377,23 @@ def box(self, column: Optional[Union[str, List[str]]] = None, **kwargs: Any) ->
365
377
366
378
Examples
367
379
--------
368
- >>> data = [
369
- ... ("A", 50, 55),
370
- ... ("B", 55, 60),
371
- ... ("C", 60, 65),
372
- ... ("D", 65, 70),
373
- ... ("E", 70, 75),
374
- ... ("F", 10, 15),
375
- ... ("G", 85, 90),
376
- ... ("H", 5, 150),
377
- ... ]
378
- >>> columns = ["student", "math_score", "english_score"]
379
- >>> df = spark.createDataFrame(data, columns)
380
- >>> df.plot.box() # doctest: +SKIP
381
- >>> df.plot.box(column="math_score") # doctest: +SKIP
382
- >>> df.plot.box(column=["math_score", "english_score"]) # doctest: +SKIP
380
+ .. plotly::
381
+
382
+ >>> data = [
383
+ ... ("A", 50, 55),
384
+ ... ("B", 55, 60),
385
+ ... ("C", 60, 65),
386
+ ... ("D", 65, 70),
387
+ ... ("E", 70, 75),
388
+ ... ("F", 10, 15),
389
+ ... ("G", 85, 90),
390
+ ... ("H", 5, 150),
391
+ ... ]
392
+ >>> columns = ["student", "math_score", "english_score"]
393
+ >>> df = spark.createDataFrame(data, columns)
394
+ >>> df.plot.box() # doctest: +SKIP
395
+ >>> df.plot.box(column="math_score") # doctest: +SKIP
396
+ >>> df.plot.box(column=["math_score", "english_score"]) # doctest: +SKIP
383
397
"""
384
398
return self (kind = "box" , column = column , ** kwargs )
385
399
@@ -419,12 +433,14 @@ def kde(
419
433
420
434
Examples
421
435
--------
422
- >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
423
- >>> columns = ["length", "width", "species"]
424
- >>> df = spark.createDataFrame(data, columns)
425
- >>> df.plot.kde(bw_method=0.3, ind=100) # doctest: +SKIP
426
- >>> df.plot.kde(column=["length", "width"], bw_method=0.3, ind=100) # doctest: +SKIP
427
- >>> df.plot.kde(column="length", bw_method=0.3, ind=100) # doctest: +SKIP
436
+ .. plotly::
437
+
438
+ >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
439
+ >>> columns = ["length", "width", "species"]
440
+ >>> df = spark.createDataFrame(data, columns)
441
+ >>> df.plot.kde(bw_method=0.3, ind=100) # doctest: +SKIP
442
+ >>> df.plot.kde(column=["length", "width"], bw_method=0.3, ind=100) # doctest: +SKIP
443
+ >>> df.plot.kde(column="length", bw_method=0.3, ind=100) # doctest: +SKIP
428
444
"""
429
445
return self (kind = "kde" , column = column , bw_method = bw_method , ind = ind , ** kwargs )
430
446
@@ -454,12 +470,14 @@ def hist(
454
470
455
471
Examples
456
472
--------
457
- >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
458
- >>> columns = ["length", "width", "species"]
459
- >>> df = spark.createDataFrame(data, columns)
460
- >>> df.plot.hist(bins=4) # doctest: +SKIP
461
- >>> df.plot.hist(column=["length", "width"]) # doctest: +SKIP
462
- >>> df.plot.hist(column="length", bins=4) # doctest: +SKIP
473
+ .. plotly::
474
+
475
+ >>> data = [(5.1, 3.5, 0), (4.9, 3.0, 0), (7.0, 3.2, 1), (6.4, 3.2, 1), (5.9, 3.0, 2)]
476
+ >>> columns = ["length", "width", "species"]
477
+ >>> df = spark.createDataFrame(data, columns)
478
+ >>> df.plot.hist(bins=4) # doctest: +SKIP
479
+ >>> df.plot.hist(column=["length", "width"]) # doctest: +SKIP
480
+ >>> df.plot.hist(column="length", bins=4) # doctest: +SKIP
463
481
"""
464
482
return self (kind = "hist" , column = column , bins = bins , ** kwargs )
465
483
0 commit comments