Top Non Javascript Boxplot Libraries In R With Examples

Last Updated 2020-05-17

In this tutorial, i will talk about some of the best libraries for drawing boxplots in R.

  1. boxplot() R native
  2. bwplot() Lattice
  3. ggplot() Ggplot2

For this tutorial, I will use stocks data which i downloaded from Kaggle.

Let us read our csv file for stock Google and convert the data in to dataframe.

In [1]: <- read.csv('data/individual_stocks_5yr/individual_stocks_5yr/GOOGL_data.csv') <- data.frame(
In [2]:
A data.frame: 2 × 7

R Boxplot

boxplot() is native library in R and it is very easy to use. Checkout boxplots in R for more details.

In [3]:

Boxplot using Lattice

If you don't have it installed, install it using install.package('lattice') in R repl or R studio.

In [4]:

We can draw the plot using bwplot() function.

In [5]:

We can rotate the plot, if we reverse the order in bwplot() function as shown below.

In [6]:
bwplot(close~Name,,ylab='Google Close Price')

Boxplot in Ggplot2

Install ggplot2 in R repl or Rstudio with install.packages('ggplot2')

In [7]:
In [9]:
ggplot(, aes(y=close)) + 
In [10]:
ggplot(, aes(y=close)) + 
  geom_boxplot(notch = TRUE) + coord_flip()

We can draw multiple box plots side by side with package gridExtra. Install it using install.packages('gridExtra')

In [11]:
gghigh <- ggplot(, aes(y=high)) +  geom_boxplot()
ggclose <- ggplot(, aes(y=close)) +  geom_boxplot()

Wrap Up!

Let me know if you know of any good R non javascript library packages by emailing me at johnludhi at I will cover it here.