
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
Change Background Color of a Plot in R
To change the focus of a plot we can do multiple things and one such thing is changing the background of the plot. If the background color of a plot is different than white then obviously it will get attention of the readers because this is unusual as most of the times the plots have white backgrounds, hence if we want to attract readers on the plot then we might use this technique. It can be done by using par(bg= "color_name").
Example
Creating a simple histogram −
> x<-rnorm(100) > hist(x)
Output
Example
Creating histogram with different background colors −
> par(bg="green") > hist(x)
Output
> par(bg="yellow") > hist(x)
Output
par(bg="blue") > hist(x)
Output
Advertisements