- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 change the scale of Y-axis if the histogram bars are higher than the axis size in R?
When we create a histogram using hist function in R, often the Y-axis labels are smaller than the one or more bars of the histogram. Therefore, the histogram does not look appealing and it becomes a little difficult to match the Y-axis values with the bars size.
To solve this problem, we can use ylim argument of hist function in which the range can be supplied to plot on the Y-axis labels.
Example
Consider the below data and its histogram −
set.seed(101) x<-runif(100,2,5) hist(x)
Output
Creating the same histogram with higher Y-axis −
Example
hist(x,ylim=c(0,25))
Output
- Related Articles
- How to change the text size of Y-axis title using ggplot2 in R?
- How to change the Y-axis title in base R plot?
- How to change the range of the X-axis and Y-axis in Matplotlib?
- How to exponentially scale the Y axis with matplotlib?
- How to change the color of bars in histogram for values that are greater than 0 or less than 0 in R?
- How to change the Y-axis title to horizontal using ggplot2 in R?
- How to increase the X-axis length of histogram in base R?
- How to change the orientation and font size of x-axis labels using ggplot2 in R?
- How to create a barplot with gaps on Y-axis scale in R?
- How to change the Y-axis values in a bar plot using ggplot2 in R?
- Change the outline color for histogram bars using ggplot2 in R.
- How to change the Y axis limit for boxplot created by using ggplot2 in R?
- How to change the axis color in base R plot?
- How to align the bars of a barplot with the X-axis using ggplot2 in R?
- How to create a histogram with Y-axis values as count using ggplot2 in R?

Advertisements