famuvie / breedR

Statistical methods for forest genetic resources analysts
http://famuvie.github.io/breedR/
GNU General Public License v3.0
31 stars 24 forks source link

Enable compare.plots() to compare variograms under the same scale #35

Open famuvie opened 9 years ago

famuvie commented 9 years ago

As a workaround, it is possible to extract the data from the variograms an plot them manually under the same scale, as follows:

library(ggplot2)

coord <- expand.grid(1:50, 1:50)
z     <- rnorm(rnorm(coord))

vg1 <- variogram(coord = coord, z = z)
vg2 <- variogram(coord = coord, z = 2*z)

isotropic_variograms <- rbind(cbind(model = "M1", vg1[["isotropic"]]),
                              cbind(model = "M2", vg2[["isotropic"]]))

# Then, you can plot the 2 variograms together under the same scale
ggplot(isotropic_variograms, aes(distance, variogram)) +
  geom_point() +
  geom_line() +
  stat_smooth(se = FALSE, method = 'auto') + 
  facet_wrap(~ model)
famuvie commented 8 years ago

Sorry. Closed by mistake.