- 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 display Y-axis labels with more decimal places in R?
To display Y-axis labels with more decimal places, we would need to round the values of the vector or column for which we want to create the plot to the appropriate number of decimal places.
After that axis function will be used for creating the graph. Before doing all this, the graph of original values should be created without axes.
Check out the below example to understand how it works.
Example
Following snippet creates a sample data frame −
x<-rnorm(10) x
Output
The following dataframe is created −
[1] -0.3002845 -0.6121883 1.9147725 -2.1135920 0.6575177 0.3540003 [7] -0.4564178 1.3474739 -0.6195008 -0.7050753
To display Y-axis labels with more decimal places in R, add the following code to the above snippet −
x<-rnorm(10) plot(x)
Output
If you execute all the above given snippets as a single program, it generates the following output −
To display Y-axis labels with more decimal places in R, add the following code to the above snippet −
x<-rnorm(10) plot(x,axes=FALSE,frame.plot=TRUE)
Output
If you execute all the above given snippets as a single program, it generates the following output −
To display Y-axis labels with more decimal places in R, add the following code to the above snippet −
x<-rnorm(10) plot(x,axes=FALSE,frame.plot=TRUE) Labels<-round(x,3) axis(2,at=Labels,labels=Labels)
Output
If you execute all the above given snippets as a single program, it generates the following output −
- Related Articles
- How to remove Y-axis labels in R?
- How to display X-axis labels with dash in base R plot?
- How to create a plot with reversed Y-axis labels in base R?
- How to display X-axis labels inside the plot in base R?
- How to display Y-axis with Euro sign using ggplot2 in R?
- How to display positive sign for X-axis labels in R using ggplot2?
- How to display a float with two decimal places in Python?
- How to display 0 at Y-axis using ggplot2 in R?
- How to display long X-axis labels in a bar chart using plotly in R?
- Display 3 decimal places in MySQL?
- How to display numbers with decimal in R data frame column?
- How to display count on Y-axis for line chart using ggplot2 in R?
- How to create a dendrogram without X-axis labels in R?
- How to create a plot with tick marks between X-axis labels in base R?
- How to generate random samples rounded to 4 decimal places in R?
