- 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 create a colored box for base R plot?
To create a colored box for base R plot, we can use box function with col argument where we can pass the color other than black because black is the default color.
We first need to create the plot using plot function and then box function will be used as shown in the below given example.
Example
To create a colored box for base R plot, use the following code −
plot(1:5) box(lwd=5,col="blue")
Output
If you execute the above given code, it generates the following output −
To create a colored box for base R plot, use the following code −
plot(1:5) box(lwd=10,col="red")
Output
If you execute the above given code, it generates the following output −
- Related Articles
- How to display the legend of a bar plot in a colored box in R?
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to create a plot in base R without margins?
- How to change the border color of box of a base R plot?
- How to create empty bar plot in base R?
- How to create horizontal lines for each bar in a bar plot of base R?
- How to create a colored frame for ggplot2 graph in R?\n
- How to create bar plot in base R with different limits for Y-axis?
- How to create vertical line for X variable at median in base R plot
- How to create horizontal line for Y variable at median in base R plot?
- How to create a plot with dashed regression line in base R?
- How to create a base R plot without axes but keeping the frame of the plot?
- How to create a plot with reversed Y-axis labels in base R?
- Create bar plot for grouped data of two columns in base R.

Advertisements