- 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 reduce the size of the area covered by legend in R for a plot created by using plot function?
By default, the area covered by legends for a plot created by using plot function is of full size that is 1 (the area size has a range of 0 to 1, where 1 refers to the full size and 0 refers to none). To reduce the size, we can use cex argument with the legend function as shown in the below example.
Example
Consider the below vectors and the plot created between these two vectors −
x<-1:10 y<-10:1 plot((x,y) legend("topright",legend=LETTERS[1:10],ncol=2)
Output
Now to create the plot with reduced size of the legend values and the legend area, we need to use the following codes −
x<-1:10 y<-10:1 plot(x,y) legend("topright",legend=LETTERS[1:10],ncol=2,cex=0.50)
Output
- Related Articles
- How to represent the legend in a plot created by using plot function with colored straight lines or stars in R?
- How to remove the border of the legend of a chart created by plot function in R?
- How to change the color and size of the axes labels of a plot created by using plot function in R?
- How to change the background color of a plot created by using plot function in R?
- How to remove the boxes around legend of a plot created by ggplot2 in R?
- How to change legend values in a bar plot created by using ggplot2 in R?
- How to change the title of a graph to italic created by using plot function in R?
- How to add a mathematical expression in axis label in a plot created by using plot function in R?
- How to make all text size same in a plot created by using ggplot2 in R?
- How to create gridlines that matches with Y-axis values in the plot created by using plot function in R?
- How to change the position of the title of a plot which is created using plot function in R?
- How to remove ticks in a plot created by using gglot2 in R?
- How to change the font size of legend in base R plot?
- How to create a plot in R with a different plot window size using plot function?
- How to add a citation in a plot created by using ggplot2 in R?

Advertisements