- 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 change the font size of legend in base R plot?
In base R, we can use legend function to add a legend to the plot. For example, if we want to create a histogram with legend on top-right position then we can use legend("topright",legend="Normal Distribution") and if we want to change the font size then we need to as cex argument as shown below:
legend("topright",legend="Normal Distribution",cex=2)
Example
Consider the below histogram −
x<−rnorm(5000) hist(x)
Output
Adding legend of different sizes −
legend("topright",legend="Normal Distribution",cex=1)
Output
legend("topleft",legend="Histogram of",cex=1.5)
Output
- Related Articles
- How to change the background color of legend in base R plot?
- How to change the font size of main title of boxplot in base R?
- How to increase the font size of the legend in my Seaborn plot using Matplotlib?
- How to change xticks font size in a matplotlib plot?
- How to set the font size of Matplotlib axis Legend?
- How to change the resolution of a plot in base R?
- How to change the axis color in base R plot?
- How to change the background color of base R plot region?
- How to change the position of X-axis in base R plot?
- How to change the Y-axis title in base R plot?
- How to change the axis ticks color in base R plot?
- How to change the text color of font in the legend using Matplotlib?
- How to change the border color of box of a base R plot?
- How to change font size in HTML?
- How to change font size in ttk.Button?

Advertisements