@@ -316,6 +316,34 @@ The ``by`` keyword can be specified to plot grouped histograms:
316316 @savefig grouped_hist.png
317317 data.hist(by = np.random.randint(0 , 4 , 1000 ), figsize = (6 , 4 ));
318318
319+ .. ipython :: python
320+ :suppress:
321+
322+ plt.close(" all" )
323+ np.random.seed(123456 )
324+
325+ In addition, the ``by `` keyword can also be specified in :meth: `DataFrame.plot.hist `.
326+
327+ .. versionchanged :: 1.4.0
328+
329+ .. ipython :: python
330+
331+ data = pd.DataFrame(
332+ {
333+ " a" : np.random.choice([" x" , " y" , " z" ], 1000 ),
334+ " b" : np.random.choice([" e" , " f" , " g" ], 1000 ),
335+ " c" : np.random.randn(1000 ),
336+ " d" : np.random.randn(1000 ) - 1 ,
337+ },
338+ )
339+
340+ @savefig grouped_hist_by.png
341+ data.plot.hist(by = [" a" , " b" ], figsize = (10 , 5 ));
342+
343+ .. ipython :: python
344+ :suppress:
345+
346+ plt.close(" all" )
319347
320348 .. _visualization.box :
321349
@@ -448,6 +476,32 @@ columns:
448476
449477 plt.close(" all" )
450478
479+ You could also create groupings with :meth: `DataFrame.plot.box `, for instance:
480+
481+ .. versionchanged :: 1.4.0
482+
483+ .. ipython :: python
484+ :suppress:
485+
486+ plt.close(" all" )
487+ np.random.seed(123456 )
488+
489+ .. ipython :: python
490+ :okwarning:
491+
492+ df = pd.DataFrame(np.random.rand(10 , 3 ), columns = [" Col1" , " Col2" , " Col3" ])
493+ df[" X" ] = pd.Series([" A" , " A" , " A" , " A" , " A" , " B" , " B" , " B" , " B" , " B" ])
494+
495+ plt.figure();
496+
497+ @savefig box_plot_ex4.png
498+ bp = df.plot.box(column = [" Col1" , " Col2" ], by = " X" )
499+
500+ .. ipython :: python
501+ :suppress:
502+
503+ plt.close(" all" )
504+
451505 .. _visualization.box.return :
452506
453507In ``boxplot ``, the return type can be controlled by the ``return_type ``, keyword. The valid choices are ``{"axes", "dict", "both", None} ``.
0 commit comments