Cómo dibujar una parcela vacía?


Necesito hacer una parcela vacía. Esto es lo mejor que se me ocurrió.

plot(0, xaxt = 'n', yaxt = 'n', bty = 'n', pch = '', ylab = '', xlab = '')

¿Alguna solución más sencilla?

P.d.: completamente vacío, sin eje, etc.

 82
Author: zx8754, 2011-01-24

9 answers

¿Qué tal algo como:

plot.new()
 85
Author: Joshua Ulrich,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-21 19:30:25

Sugiero que alguien necesita hacer un gráfico vacío para agregar algunos gráficos en él más tarde. Entonces, usando

plot(1, type="n", xlab="", ylab="", xlim=c(0, 10), ylim=c(0, 10))

Puede especificar los límites de los ejes de su gráfico.

 45
Author: stukselbax,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-01 13:50:15

Esto es ligeramente más simple que su solución original:

plot(0,type='n',axes=FALSE,ann=FALSE)
 20
Author: Ben Bolker,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-06-01 23:32:06

Adam, siguiendo su comentario anterior ("Quería que la parcela vacía sirviera como relleno en una parcela multiplot (mfrow)."), lo que realmente quieres es la opción mfg

    par(mfg=c(row,column))

- que controla dónde desea poner la siguiente parcela. Por ejemplo, para poner una parcela en medio de un multiplot 3x3, haga

    par(mfrow=c(3,3))
    par(mfg=c(2,2))
    plot(rnorm(10))
 15
Author: Dag Hjermann,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-23 16:41:27

Lo siguiente no traza nada en la trama y permanecerá vacío.

plot(NULL, xlim=c(0,1), ylim=c(0,1), ylab="y label", xlab="x lablel")

Esto es útil cuando desea agregar líneas o puntos después dentro de un bucle for o algo similar. Solo recuerde cambiar los valores xlim y ylim en función de los datos que desea trazar.

 15
Author: Mehrad Mahmoudian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-17 12:53:33

Necesita una nueva ventana de trazado, y también un sistema de coordenadas, por lo que necesita plot.new() y plot.window(), luego puede comenzar a agregar elementos de gráfico:

plot.new( )
plot.window( xlim=c(-5,5), ylim=c(-5,5) )

points( rnorm(100), rnorm(100) )
axis( side=1 )

Gráfico de ejemplo

 10
Author: why.knot,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-06 05:21:48

Hay un interés en su solución que plot.new() no tiene: en el diagrama vacío que "dibuja" puede escribir texto en coordenadas especificadas con text(x = ..., y = ..., your_text).

 4
Author: Dotoma,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-28 12:21:25
grid.newpage() ## If you're using ggplot

grid() ## If you just want to activate the device.
 2
Author: Brandon Bertelsen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-25 05:52:27

Una gráfica vacía con algunos textos que se establecen en posición.

plot(1:10, 1:10,xaxt="n",yaxt="n",bty="n",pch="",ylab="",xlab="", main="", sub="")
mtext("eee", side = 3, line = -0.3, adj = 0.5)
text(5, 10.4, "ddd")
text(5, 7, "ccc")
 0
Author: Nick Dong,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-03 18:10:38