- 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 color of line in xyplot in R?
To change the color of line in xyplot, we can use col argument.
For example, if we have two vectors say X and Y and we want to create a red colored xyplot between X and Y then we can use the following command −
xyplot(x~y,type="l", col="red")
Check out the below example to understand how it works.
Example
To change the color of line in xyplot, use the code given below −
set.seed(123) library(lattice) xyplot(1:5~rpois(5,5),type="l",col="blue")
Output
If you execute the above given code, it generates the following output −
Advertisements