Skip to content

strange error

4 messages · alicekalkuhl at freenet.de, Duncan Murdoch, Tom +1 more

#
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
#
On 25/05/2016 12:56 PM, alicekalkuhl at freenet.de wrote:
This is an RStudio problem, not an R problem.  One solution is to make 
the "Plots" pane bigger.  There may be others -- you'll have to contact 
RStudio for help with it.

Duncan Murdoch
Tom
#
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:
#
On Wed, 25 May 2016 18:56:47 +0200
alicekalkuhl at freenet.de wrote:
Alice,

Have you tried running the code in R in a terminal?  If the error
persists, then this may be the right place to ask for help.  If it is
specific to R Studio, then you need to ask them.