- Related Questions & Answers
- How to create a plot in R with gridlines using plot function?
- How to plot a function in R?
- How to plot a function with ggplot2 in R?
- How to create a horizontal bar plot using barplot function in R?
- How to create plot in R with different shape of points?
- How to create a line chart in R using plot function with larger width?
- How to create a staircase plot in R?
- How to create a dot plot using ggplot2 in R?
- How to create a plot using rgb colors in R?
- How to create a plot with cross sign in R?
- How to create a bar plot with ggplot2 using stat_summary in R?
- How to create a plot in base R with tick marks of larger size?
- How to change the background color of a plot created by using plot function in R?
- How to create the stacked bar plot using ggplot2 in R with labels on the plot?
- How to write the plot title in multiple lines using plot function in R?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

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 −

> dev.new(width=10, height=5, unit="in") > plot(x,y)

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

> dev.new(width=5, height=5, unit="cm") > plot(x,y)

Plotting with 100x50 pixel −

> dev.new(width=100, height=50, unit="px") > plot(x,y)

Advertisements