[R] strange error
Tom Wright
tom at maladmin.com
Wed May 25 22:16:44 CEST 2016
It may not be the problem, but with RStudio this error pops up when
the area reserved for plotting is too small. Typically this area is in
the right hand column, if you have this minimised (perhaps to maximise
space for typing) you will hit this problem. Try making it bigger.
Edit: Just ran your code, the problem is with the line
par(oma = c(0, 0, 3, 0))
This sets the plot outer margins, my guess is that you have used this
command then managed to save the settings to your default environment.
Changing to:
par(oma = c(1, 4, 3, 4))
which I think is the default, fixes the code on my system
On Wed, May 25, 2016 at 12:56 PM, <alicekalkuhl at freenet.de> wrote:
> Hello everyone,
> almost every time I try to plot something R gives me the following mistake:
> Error in plot.new() : figure margins too large
> One example would be, when I tried to run a function, somebody published to create a Lorenz Attractor:
>
> parameters <- c(s = 10, r = 28, b = 8/3) state <- c(X = 0, Y = 1, Z = 1)
> Lorenz <- function(t, state, parameters) { with(as.list(c(state, parameters)), { dX <- s * (Y - X) dY <- X * (r - Z) - Y dZ <- X * Y - b * Z list(c(dX, dY, dZ)) }) }
> times <- seq(0, 50, by = 0.01) library(deSolve) out <- ode(y = state, times = times, func = Lorenz, parms = parameters)
> par(oma = c(0, 0, 3, 0)) plot(out, xlab = "time", ylab = "-") plot(out[, "Y"], out[, "Z"], pch = ".", type = "l") mtext(outer = TRUE, side = 3, "Lorenz model", cex = 1.5)
>
> It turns out to be really problematic, because there are barely functions I can plot.
> My version of RStudio is R version 3.2.3 (2015-12-10) -- "Wooden Christmas Tree" and my computer uses Windows 8.1.
> Would it be possible to avoid the problem by using Windows 10?
> Or is there anything else I can do?
>
> Thank you in advance,
> Alice de Sampaio Kalkuhl
>
>
>
> ---
> Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! Rundum glücklich mit freenetMail
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list