
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
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.
Example
Consider the below vectors x and y −
> x<-1:20 > y<-20:1
Plotting with default −
> plot(x,y)
Output
Plotting with 10-inch-wide and 5 inch in height −
> dev.new(width=10, height=5, unit="in") > plot(x,y)
Output
Plotting with 10-cm-wide and 5-cm in height −
> dev.new(width=5, height=5, unit="cm") > plot(x,y)
Output
Plotting with 100x50 pixel −
> dev.new(width=100, height=50, unit="px") > plot(x,y)
Output
- 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 a line chart in R using plot function with larger width?
- How to create plot in R with different shape of points?
- Python - Create a Time Series Plot using Line Plot with Seaborn
- 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 plot in base R with tick marks of larger size?
- How to create a bar plot with ggplot2 using stat_summary in R?
- Python - Create a Time Series Plot with multiple columns using Line Plot
- How to change the background color of a plot created by using plot function in R?
Advertisements