Tal Galili
Tal Galili

Reputation: 25306

How to use plot.window? (in R)

When I run the following code:

xlim <- c(-30,30)
ylim <- c(-5,5)
plot.window(xlim , ylim )
plot.new()
points(1,1)
points(0,0)

For some reason, all I'm getting is a graphic window where it seems that the xlim/ylim are c(0,1).

Did I miss something about how to use the plot.window ?

Thanks.

Upvotes: 2

Views: 12798

Answers (1)

tim_yates
tim_yates

Reputation: 171074

You want to do plot.window() and plot.new() in the opposite order:

xlim <- c(-30,30)
ylim <- c(-5,5)
plot.new()
plot.window( xlim , ylim )
points(1,1)
points(0,0)

Currently, the new() is overriding the settings passed in window()

Upvotes: 3

Related Questions