- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create side-by-side boxplot in base R?
Often, we need to compare continuous variables using boxplots and thus side-by-side boxplots are required. Creating side-by-side boxplot in base R can be done with the help of creating space for graphs with the help of par(mfrow=). In this function, we can define the number of graphs and the sequence of these graphs, thus creation of side-by-side boxplot will become easy.
Consider the below vectors −
set.seed(100) x<-rnorm(500,2,1) y<-rnorm(500,2,0.5)
Define the range for Y-axis −
Y_range<-range(x,y)
Creating graph space using par(mfrow=) −
par(mfrow=c(1,2))
Creating first boxplot −
boxplot(x,ylim=Y_range)
This will create below output −
Creating second boxplot −
boxplot(y,ylim=Y_range)
- Related Articles
- How to create side by side histograms in base R?
- How to create side by side barplot in base R?
- How to create a horizontal boxplot in base R?
- How to create boxplot for multiple categories in base R?
- How to create boxplot in base R without axes labels?
- How to create a boxplot without frame in base R?
- How to create a rectangle inside boxplot in base R?
- How to create boxplot for a list object in base R?
- How to hide outliers in base R boxplot?
- How to create boxplot for multiple categories with long names in base R?
- How to create a boxplot with log of the variable in base R?
- How to create a boxplot in base R without any axes except Y?
- Create histogram with horizontal boxplot on top in base R.
- How to create boxplot in base R with higher width of the box lines?
- How to align images side by side with CSS?

Advertisements