- 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 histograms in base R?
To create side by side histograms in base R, we first need to create a histogram using hist function by defining a larger limit of X-axis with xlim argument. After that we can create another histogram that has the larger mean and smaller standard deviation so that the bars do not clash with each other and add=T argument must also be added inside the second hist function.
Example
hist(rnorm(5000,mean=5,sd=2.1),col="green",xlim=c(1,20))
Output
Example
hist(rnorm(5000,mean=15,sd=1.25),col="red",add=T)
Output
- Related Articles
- How to create side-by-side boxplot in base R?
- How to create side by side barplot in base R?
- How to plot two histograms side by side using Matplotlib?
- How to align images side by side with CSS?
- How to create facetted histograms using ggplot2 in R?
- How to plot two Seaborn lmplots side-by-side (Matplotlib)?
- How to make two plots side-by-side using Python?
- Displaying Files Side by Side in Linux
- How we can put two divisions side by side in HTML?
- How we can put three divisions side by side in HTML?
- How to plot bar graphs with same X coordinates side by side in Matplotlib?
- How to create the boxplots in base R ordered by means?
- How to create heatmap in base R?
- How do I plot two countplot graphs side by side in Seaborn using Matplotlib?
- How to create an arrow in base R?

Advertisements