- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 add a picture to plot in base R?
To add a picture to a plot in base R, we first need to read the picture in the appropriate format and then rasterImage function can be used. The most commonly used format for picture in R is PNG. A picture in PNG format can be added to a plot by supplying the values in the plot where we want to add the picture.
Loading png package:
Reading png file:
> Picture<-readPNG(system.file("img","Rlogo.png",package="png")) Creating a blank plot: > plot(1:10,ty="n")
Adding the picture in png file to the above plot:
> plot(1:10,ty="n") > rasterImage(Picture,5,5,7,7)
- How to assign a value to a base R plot?
- How to rotate text in base R plot?
- How to remove Index in base R plot?
- How to display fraction in base R plot?
- How to create a plot in base R without margins?
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to add a regression line to a plot in base R if intercept and slope are given?
- How to add a variable to the model in base R?
- How to create a colored box for base R plot?
- How to create empty bar plot in base R?
- How to display x-bar in base R plot?
- How to display infinity symbol in base R plot?
- How to change the resolution of a plot in base R?
- How to include a zero with tick in base R plot?