[SOLVED] Plot montage in RGeostats

Here you can report the problems encountered with the graphical functions (db.plot, vario.plot, ...)

[SOLVED] Plot montage in RGeostats

Postby Jeffrey Yarus » Tue Mar 09, 2021 12:07 am

HI Dider:
I trust you are doing well and you have hopefully had your Covid-19 vaccine!  

I am 4 weeks into the semester, and my students are using RGeostats with reasonable success!  However, I have a question that only you can answer!
One of the things we do in the class for reporting is to use 'knitr' to summarize their homework assignments; so they build their code in RMarkdown, and then 'knit' to PDF.  To create nice reports, we encourage that appropriate figures be 'binded' to an object so we can create montages of the figures instead of printing them out in a kind of linear fashion.  In RGeostats, can we bind figures to an object to create a figure "montage?"  It seems if I try to create an assignment variable to a PLOT in RGeostats, it doesn't work.  For example, here is a piece of a code chunk...

var2 <- plot(data.2dir.vario,type = "p", pch = 19, npairpt=T, npairdw=F, pos.legend = 1, cex = 0.7,
     title = paste(property, "Experimental 2 Directional Variogram"),
     xlab = "Log distance", ylab = expression(paste("Variance (", gamma, "(h))", sep="")))

What returns in the global environment is: var1 NULL (Empty)

As usual, your assistance and recommendations are greatly appreciated... 
Amicalement,
Jeffrey
Jeffrey Yarus
 
Posts: 48
Joined: Wed Jun 26, 2019 9:39 pm

Re: Plot montage in RGeostats

Postby Fabien Ors » Fri Mar 12, 2021 10:21 am

Dear Jeffrey,

I confirm that vario.plot function (the one automatically called when using plot(vario)) returns NULL.

According Rmarkdown documentation : https://bookdown.org/yihui/rmarkdown-co ... -side.html ...
if you want to display two or more RGeostats plots (or any R plots) side-by-side, I suggest you in your Rmd file to play with the following R chunk parameters:
  • figures-side : Indicates that you want side-by-side figures
  • fig.show : How to show/arrange the plots. Possible values[asis,hold,animate,hide] => use "hold" value
  • out.width : Width of each sub-plot in the output document, which can be different with its physical fig.width => use a width percentage at "50%" for example

Code: Select all
```{r, figures-side, fig.show="hold", out.width="50%"}
plot(data.2dir.vario,type = "p", pch = 19, npairpt=T, npairdw=F, pos.legend = 1, cex = 0.7,
     title = paste(property, "Experimental 2 Directional Variogram #1"),
     xlab = "Log distance", ylab = expression(paste("Variance (", gamma, "(h))", sep="")))
plot(data.2dir.vario,type = "p", pch = 19, npairpt=T, npairdw=F, pos.legend = 1, cex = 0.7,
     title = paste(property, "Experimental 2 Directional Variogram #2"),
     xlab = "Log distance", ylab = expression(paste("Variance (", gamma, "(h))", sep="")))
```


Hope this helps
Fabien Ors
Administrateur du site
 
Posts: 226
Joined: Thu Sep 20, 2012 1:07 pm


Return to Graphical representation

Who is online

Users browsing this forum: No registered users and 4 guests

cron