Pregunta

Quiero usar cuadrícula. Table () en una parcela existente en R. Sin embargo, no puedo localizar esta tabla en el lado derecho de mi tabla.Así que la cosa es:

En primer lugar, hago un histograma de mis datos:

hist(as.numeric(unlist((vels[counts]))),freq=F,
  col="gray",border="black",ylim=c(0,0.15),
  xlab=paste(names(vels)[counts]),
  main=paste("Weibull fitting",names(vels[counts])))

Después de eso, he implementado una función que parcelas en un gráfico existente, la curva de WEIBULL proporciona ambos parámetros A y K:

plot_weibull(K_value,A_value)

Y finalmente quiero colocar un archivo .Frame usando la cuadrícula. Table () porque muestra las celdas en una forma muy bonita, y puede usar texto en cursiva y negrita en celdas.

grid.table(round(values,3),cex=0.75,show.rownames=T,
  show.colnames=T,show.hlines=T)

El problema es que esta tabla aparece en el centro del dispositivo frente al histograma y la curva, y quiero que esté en el lado derecho.

Después de todo, me gustaría saber una herramienta que haga clic en el gráfico, recibiría el área bajo mi curva de Weibull.

¿Fue útil?

Solución

The hist function is base graphics and the grid.table function is grid graphics. The 2 graphics systems do not play nicely together without extra effort (as you have noticed).

The easiest fix is to use the addtable2plot function from the plotrix package rather than grid.table. It may not look the same but it would be simple.

Another option is to use a grid graphics function to create the histogram, such as something from the lattice or ggplot2 packages (both can do histograms), then create a specific viewport using grid graphics functions and use grid.table to put the table into that viewport.

Last, if you really want to mix them then see the gridBase package for ways to mix grid and base graphics.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top