A rug plot is a simple plot to explore distributions of a continous variable. For example, let's say you want to explore salaries of employees. A rug plot will add a line for each salaray creating a dark dense area where the majority of salaries are located. In this article, we will see how to create a rug plot with Seaborn.
to create a rug plot in seaborn, we use the
rugplot method. We can pass a dataframe to this method and specify which column/feature to use on the x-axis with the
x parameter. There is no use for the y-axis in a rug plot. Below, we create a rug plot using the build in tips dataset.
import seaborn as sns sns.set_theme() tips = sns.load_dataset("tips") sns.rugplot(data = tips, x = "total_bill")