We use a histogram to plot the distribution of a continuous variable, while we can use a bar chart to plot the distribution of a categorical variable. Let us take the example of IRIS dataset in R. We will plot a histogram of IRIS dataset with leveraging “ggplot2” package in R. “Sepal.Length” is a continuous variable which is plotted below onto the x-axis. Code: ggplot(data = iris,aes(x=Sepal.Length))+geom_histogram(fill="lightblue",col="blue") We will plot a bar chart of IRIS dataset with leveraging “ggplot2” package in R. “Species” is a categorical variable which is plotted below onto the x-axis. Code: ggplot(data = iris,aes(x=Species))+geom_bar(fill="skyblue")