How to create a plot in R with a different plot window size using plot function?

We can create plots in R with having different plot window sizes. This will be helpful when we want to express X-axis or Y-axis differently. Also, the change in the size of the plot window will help us to paste the plot in places that are short or large. For example, if we want to present the plot in a business meeting then we can increase its size and if we want to publish it in a paper then its size can be decreased.


Consider the below vectors x and y −

> x<-1:20
> y<-20:1

Plotting with default −

> plot(x,y)


Plotting with 10-inch-wide and 5 inch in height −

>, height=5, unit="in")
> plot(x,y)


Plotting with 10-cm-wide and 5-cm in height −

>, height=5, unit="cm")
> plot(x,y)


Plotting with 100x50 pixel −

>, height=50, unit="px")
> plot(x,y)


Updated on: 12-Aug-2020

10K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started