Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated into the data structures from pandas.
Seaborn aims to make visualization of the central part of exploring and understanding data. It provides dataset-oriented APIs, so that we can switch between different visual representations for the same variables for a better understanding of the dataset.
In this article, we are going to add an outline or edge color to a histogram. The task can be done using the seaborn.distplot() method.
- aSeries, 1d-array, or list: Observed data. If this is a Series object with a name attribute, the name will be used to label the data axis.
- binsargument for matplotlib hist(), or None, optional: Specification of hist bins. If unspecified, as reference rule is used that tries to find a useful default.
- colormatplotlib color, optional: Color to plot everything but the fitted curve in.
- labelstring, optional: Legend label for the relevant component of the plot.
- axmatplotlib axis, optional: If provided, plot on this axis.
- axmatplotlib Axes: Returns the Axes object with the plot for further tweaking.
We are mainly going to use the hist_kws parameters of this method like edgecolor, color, linewidth, etc, as it deals with the outline and edges of the histogram, it takes a dictionary value.
Below are some examples which depict how to add an outline or edge color to Histogram:
Below is the dataset through which the histogram is to be illustrated:
Now illustrating a histogram and also adding an outline to it.
Also, illustrating a histogram and adding an edge color to it.
Here is another dataset through which a histogram is to be depicted:
Now below is the illustration:
Here is another example to add an outline or edge color to Histogram.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.