More on Pandas-Matplotlib integration
Pandas provides the DataFrame data structure commonly used in handling multivariate data. When we usually use the Pandas package for data I/O, storage, and preprocessing, it also provides a number of native integrations with Matplotlib for quick visualization.
To create these plots, we can call df.plot(kind=plot_type)
, df.plot.scatter()
, and so on. Here is a list of available plot types:
line
: Line plot (default)bar
: Vertical bar plotbarh
: Horizontal bar plothist
: Histogrambox
: Boxplotkde
: Kernel Density Estimation (KDE) plotdensity
: The same askde
area
: Area plotpie
: Pie plot
We have created some of the simpler graphs in the previous chapters. Here, we will take the density plot as an example for discussion.
Showing distribution with the KDE plot
Similar to a histogram, the KDE plot is a method to visualize the shape of data distribution. It uses kernel smoothing to create smooth curves and is often combined with a histogram. It is useful in exploratory...