3 ways to make a barplot : From Basic To Interactive

R-Ladies Tunis

15/06/2020

Introduction

Nowadays we all talk about the power of graphs. The purpose of a graph is to present data effectively and in a simple way. A graph is more effective than a text. In this article, we will show you how to create a barplot using R in three different ways. A barplot is used to visualize counts of unique data point values in the sample space of a categorical variable. Let’s get started.

Basic Barplot

First, we will create a basic barplot using barplot() function:

Barplot using ggplot2

Now, let’s make the graph look prettier using ggplot2. The geom_bar function we can determine the color of the bars. With ggtitle() you can add the title of the graph and the title of the axes.

Barplot using plotly

Now let’s make the barplot interactive using plotly. An interactive graph is very useful when we work with dashboards.