@@ -203,13 +203,6 @@ To get horizontal bar plots, pass ``kind='barh'``:
203
203
@savefig barh_plot_stacked_ex.png
204
204
df2.plot(kind = ' barh' , stacked = True );
205
205
206
- Pandas tries to be pragmatic about plotting DataFrames or Series
207
- that contain missing data. When it makes sense missing values will
208
- be filled with 0 (as is the case with bar plots). For other plots,
209
- like line plots, filling in 0 usually doesn't make sense, and so pandas doesn't
210
- try to guess. If you want to be explicit you can always call
211
- :meth: `~pandas.DataFrame.fillna ` before plotting.
212
-
213
206
.. _visualization.hist :
214
207
215
208
Histograms
@@ -684,6 +677,44 @@ See the `matplotlib pie documenation <http://matplotlib.org/api/pyplot_api.html#
684
677
685
678
plt.close(' all' )
686
679
680
+ .. _visualization.missing_data
681
+
682
+ Plotting with Missing Data
683
+ --------------------------
684
+
685
+ Pandas tries to be pragmatic about plotting DataFrames or Series
686
+ that contain missing data. Missing values are dropped, left out, or filled
687
+ depending on the plot type.
688
+
689
+ +----------------+--------------------------------------+
690
+ | Plot Type | NaN Handling |
691
+ +================+======================================+
692
+ | Line | Leave gaps at NaNs |
693
+ +----------------+--------------------------------------+
694
+ | Line (stacked) | Fill 0's |
695
+ +----------------+--------------------------------------+
696
+ | Bar | Fill 0's |
697
+ +----------------+--------------------------------------+
698
+ | Scatter | Drop NaNs |
699
+ +----------------+--------------------------------------+
700
+ | Histogram | Drop NaNs (column-wise) |
701
+ +----------------+--------------------------------------+
702
+ | Box | Drop NaNs (column-wise) |
703
+ +----------------+--------------------------------------+
704
+ | Area | Fill 0's |
705
+ +----------------+--------------------------------------+
706
+ | KDE | Drop NaNs (column-wise) |
707
+ +----------------+--------------------------------------+
708
+ | Hexbin | Drop NaNs |
709
+ +----------------+--------------------------------------+
710
+ | Pie | Fill 0's |
711
+ +----------------+--------------------------------------+
712
+
713
+ If any of these defaults are not what you want, or if you want to be
714
+ explicit about how missing values are handled, consider using
715
+ :meth: `~pandas.DataFrame.fillna ` or :meth: `~pandas.DataFrame.dropna `
716
+ before plotting.
717
+
687
718
.. _visualization.tools :
688
719
689
720
Plotting Tools
0 commit comments