Seaborn provides an API on top of Matplotlib that offers sane choices for plot style and color defaults, defines simple high-level functions for common statistical plot types, and integrates with the functionality provided by Pandas DataFrame s.
Seaborn is more comfortable in handling Pandas data frames. It uses basic sets of methods to provide beautiful graphics in python. Matplotlib works efficiently with data frames and arrays.It treats figures and axes as objects. It contains various stateful APIs for plotting.
Explanation: This is the one kind of scatter plot of categorical data with the help of seaborn. Categorical data is represented on the x-axis and values correspond to them represented through the y-axis. . striplot() function is used to define the type of the plot and to plot them on canvas using.
It depends a bit on which seaborn function you are using.
The plotting functions in seaborn are broadly divided into two classes
regplot
, boxplot
, kdeplot
, and many othersrelplot
, catplot
, displot
, pairplot
, jointplot
and one or two othersThe first group is identified by taking an explicit ax
argument and returning an Axes
object. As this suggests, you can use them in an "object oriented" style by passing your Axes
to them:
f, (ax1, ax2) = plt.subplots(2)
sns.regplot(x, y, ax=ax1)
sns.kdeplot(x, ax=ax2)
Axes-level functions will only draw onto an Axes
and won't otherwise mess with the figure, so they can coexist perfectly happily in an object-oriented matplotlib script.
The second group of functions (Figure-level) are distinguished by the fact that the resulting plot can potentially include several Axes which are always organized in a "meaningful" way. That means that the functions need to have total control over the figure, so it isn't possible to plot, say, an lmplot
onto one that already exists. Calling the function always initializes a figure and sets it up for the specific plot it's drawing.
However, once you've called lmplot
, it will return an object of the type FacetGrid
. This object has some methods for operating on the resulting plot that know a bit about the structure of the plot. It also exposes the underlying figure and array of axes at the FacetGrid.fig
and FacetGrid.axes
arguments. The jointplot
function is very similar, but it uses a JointGrid
object. So you can still use these functions in an object-oriented context, but all of your customization has to come after you've called the function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With