# Create Plot Window of Particular Size in R & RStudio (3 Examples)

On this page, I’ll illustrate how to open a new plot window with a specific size in the R programming language.

The article will contain these content blocks:

Here’s how to do it!

## Example 1: Creating Plot Window of Particular Size in R

The following code illustrates how to open a new plot window using the dev.new function.

Note that, depending on your device, this R code may not work using RStudio. Please have a look at the next example for more details about new plot windows in RStudio.

However, let’s move on to the R example code:

```plot.new() # Create empty plot in default window dev.new(width = 15, height = 3) # Create new plot window plot(5:1) # Draw plot```

After running these lines of code, a new plot window with a width of 15 and a height of 3 that shows a scatterplot should be opened.

## Example 2: Creating Plot Window of Particular Size in RStudio

In this example, I’ll explain how to create new plot windows with a specific size in RStudio. For this, we need to specify the noRStudioGD argument to be equal to TRUE:

```plot.new() # Create empty plot in RStudios' default window dev.new(width = 15, # Create new plot window height = 3, noRStudioGD = TRUE) plot(5:1) # Draw plot```

A new plot window with particular size should be opened at this point.

## Example 3: Creating Plot Window of Particular Size Using Different Units

This example explains how to use different units within the dev.new function.

In this example, I’m setting the unit argument of the dev.new function to “px” (i.e. pixel).

Note that the width and height values have to be much larger when we are using pixels as unit:

```plot.new() # Create empty plot in RStudios default window dev.new(width = 200, # Create new plot window height = 600, unit = "px", noRStudioGD = TRUE) plot(5:1) # Draw plot```

Another graphic window should be opened after running the previous R syntax.

## Video, Further Resources & Summary

Do you want to learn more about graphics in R? Then you might want to have a look at the following video tutorial of my YouTube channel. In the video, I’m explaining the R code of this tutorial:

Furthermore, I can recommend to have a look at the related articles on this homepage:

This article illustrated how to create a manually defined graphic window in the R programming language. Please tell me about it in the comments section below, if you have further questions.

Subscribe to the Statistics Globe Newsletter