
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add Mathematical Expression in Axis Label in R Plot
When we create a plot using plot function in R, the axes titles are either chosen by R automatically based on the vectors passed through the function or we can use ylab or xlab for particular axes. To add a mathematical expression in an axis label, we can use title function with expression function to define the mathematical expression.
Consider the below vectors and create scatterplot between the two −
Example
set.seed(111) x<-rpois(1000,20) y<-rpois(1000,15) plot(x,y)
output
Now suppose, we want to remove y from the Y-axis and put alpha square then it can be done as shown below −
Example
plot(x,y,ylab="") title(ylab=expression(alpha^2))
Advertisements