@@ -126,7 +126,7 @@ These include:
126
126
* :ref: `'hist' <visualization.hist >` for histogram
127
127
* :ref: `'kde' <visualization.kde >` or ``'density' `` for density plots
128
128
* :ref: `'area' <visualization.area_plot >` for area plots
129
- * :ref: `'scatter' <visualization.scatter_matrix >` for scatter plots
129
+ * :ref: `'scatter' <visualization.scatter >` for scatter plots
130
130
* :ref: `'hexbin' <visualization.hexbin >` for hexagonal bin plots
131
131
* :ref: `'pie' <visualization.pie >` for pie plots
132
132
@@ -427,6 +427,52 @@ To produce an unstacked plot, pass ``stacked=False``. Alpha value is set to 0.5
427
427
@savefig area_plot_unstacked.png
428
428
df.plot(kind = ' area' , stacked = False );
429
429
430
+ .. _visualization.scatter :
431
+
432
+ Scatter Plot
433
+ ~~~~~~~~~~~~
434
+
435
+ .. versionadded :: 0.13
436
+
437
+ You can create scatter plots with ``DataFrame.plot `` by passing ``kind='scatter' ``.
438
+ Scatter plot requires numeric columns for x and y axis.
439
+ These can be specified by ``x `` and ``y `` keywords each.
440
+
441
+ .. ipython :: python
442
+ :suppress:
443
+
444
+ np.random.seed(123456 )
445
+ plt.figure()
446
+
447
+ .. ipython :: python
448
+
449
+ df = DataFrame(rand(50 , 4 ), columns = [' a' , ' b' , ' c' , ' d' ])
450
+
451
+ @savefig scatter_plot.png
452
+ df.plot(kind = ' scatter' , x = ' a' , y = ' b' );
453
+
454
+ To plot multiple column groups in a single axes, repeat ``plot `` method specifying target ``ax ``.
455
+ It is recommended to specify ``color `` and ``label `` keywords to distinguish each groups.
456
+
457
+ .. ipython :: python
458
+
459
+ ax = df.plot(kind = ' scatter' , x = ' a' , y = ' b' ,
460
+ color = ' DarkBlue' , label = ' Group 1' );
461
+ @savefig scatter_plot_repeated.png
462
+ df.plot(kind = ' scatter' , x = ' c' , y = ' d' ,
463
+ color = ' DarkGreen' , label = ' Group 2' , ax = ax);
464
+
465
+ You can pass other keywords supported by matplotlib ``scatter ``.
466
+ Below example shows a bubble chart using a dataframe column values as bubble size.
467
+
468
+ .. ipython :: python
469
+
470
+ @savefig scatter_plot_bubble.png
471
+ df.plot(kind = ' scatter' , x = ' a' , y = ' b' , s = df[' c' ]* 200 );
472
+
473
+ See the :meth: `scatter <matplotlib.axes.Axes.scatter> ` method and the
474
+ `matplotlib scatter documenation <http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter >`__ for more.
475
+
430
476
.. _visualization.hexbin :
431
477
432
478
Hexagonal Bin Plot
0 commit comments