I'm having difficulty getting plots into ioslides. It seems to me that the scale is completely out, but I can't figure out what to do about it. Whatever I try, I get the title slide, then a second with a horizontal line and a vertical line in the bottom right corner. It looks like a badly scaled plot about 25 times the size of the plotting area, so only a fragment is visible. This is the code I've tried: --- title: "Barking up the wrong tree" author: "Patrick Connolly" date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" output: ioslides_presentation --- ```{r global_options, echo=FALSE} knitr::opts_chunk$set(tidy=TRUE, warning=FALSE, message=FALSE, cache=FALSE, dpi=600) ``` ```{r use these functions, echo= FALSE} load(".RData") ## code for 6 plotting functions `` ## 6 different Trees ```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7, fig.height = 5} ### par(mfrow = c(2, 3)) plot1() plot2() plot3() plot4() plot5() plot6() } ``` If I run the plot functions in the Console, it all works and displays correctly in Rstudiio's plot panel, even the mfrow bit. But I haven't worked out how to include the code into Rmarkdown. I thought it might be less taxing to not try putting the 6 plots on the same slide, but it makes no difference when I commented out the mfrow bit. I'm not very familiar with the workings of Markdown or Rstudio, but it does seem strange to me that I need to specifically load the global environment otherwise it's not visible. Is that to be expected? Ideas welcome, particularly about scaling. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
This is not reproducible because you have not provided the plot code or sample data. Output of sessionInfo would probably be appropriate as well. As to whether needing to load objects is typical... yes, rmarkdown runs from a fresh environment to emphasize reproducibility, but your load command is bypassing that for us. On August 23, 2018 2:15:19 AM PDT, Patrick Connolly <p_connolly at slingshot.co.nz> wrote:>I'm having difficulty getting plots into ioslides. It seems to me >that the scale is completely out, but I can't figure out what to do >about it. Whatever I try, I get the title slide, then a second with a >horizontal line and a vertical line in the bottom right corner. It >looks like a badly scaled plot about 25 times the size of the plotting >area, so only a fragment is visible. > >This is the code I've tried: > >--- >title: "Barking up the wrong tree" >author: "Patrick Connolly" >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" >output: ioslides_presentation >--- > >```{r global_options, echo=FALSE} >knitr::opts_chunk$set(tidy=TRUE, > warning=FALSE, > message=FALSE, > cache=FALSE, > dpi=600) >``` > >```{r use these functions, echo= FALSE} > load(".RData") ## code for 6 plotting functions > >`` >## 6 different Trees > >```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7, >fig.height = 5} > >### par(mfrow = c(2, 3)) >plot1() >plot2() >plot3() >plot4() >plot5() >plot6() >} >``` > >If I run the plot functions in the Console, it all works and displays >correctly in Rstudiio's plot panel, even the mfrow bit. But I haven't >worked out how to include the code into Rmarkdown. I thought it might >be less taxing to not try putting the 6 plots on the same slide, but >it makes no difference when I commented out the mfrow bit. > >I'm not very familiar with the workings of Markdown or Rstudio, but it >does seem strange to me that I need to specifically load the global >environment otherwise it's not visible. Is that to be expected? > >Ideas welcome, particularly about scaling.-- Sent from my phone. Please excuse my brevity.
On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote: |> This is not reproducible because you have not provided the plot |> code or sample data. Output of sessionInfo would probably be |> appropriate as well. I took it as read that the plotting functions themselves aren't an issue since they operate as intended outside of the Rmarkdown space. Any function that uses the function plot() successfully will do. I was trying to ascertain how I should be setting up the scaling. |> As to whether needing to load objects is typical... yes, rmarkdown |> runs from a fresh environment to emphasize reproducibility, but |> your load command is bypassing that for us. The objects loaded from .RData took hours of simulating and it's out of the question to run them again inside Rmarkdown. Though the script used in the creation of .RData is reproducable, perhaps it would be clearer for me to have saved the objects to a file by a different name. Is there a better way to do that?? |> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly <p_connolly at slingshot.co.nz> wrote: |> >I'm having difficulty getting plots into ioslides. It seems to me |> >that the scale is completely out, but I can't figure out what to do |> >about it. Whatever I try, I get the title slide, then a second with a |> >horizontal line and a vertical line in the bottom right corner. It |> >looks like a badly scaled plot about 25 times the size of the plotting |> >area, so only a fragment is visible. |> > |> >This is the code I've tried: |> > |> >--- |> >title: "Barking up the wrong tree" |> >author: "Patrick Connolly" |> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" |> >output: ioslides_presentation |> >--- |> > |> >```{r global_options, echo=FALSE} |> >knitr::opts_chunk$set(tidy=TRUE, |> > warning=FALSE, |> > message=FALSE, |> > cache=FALSE, |> > dpi=600) |> >``` |> > |> >```{r use these functions, echo= FALSE} |> > load(".RData") ## code for 6 plotting functions |> > |> >`` |> >## 6 different Trees |> > |> >```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7, |> >fig.height = 5} |> > |> >### par(mfrow = c(2, 3)) |> >plot1() |> >plot2() |> >plot3() |> >plot4() |> >plot5() |> >plot6() |> >} |> >``` |> > |> >If I run the plot functions in the Console, it all works and displays |> >correctly in Rstudiio's plot panel, even the mfrow bit. But I haven't |> >worked out how to include the code into Rmarkdown. I thought it might |> >be less taxing to not try putting the 6 plots on the same slide, but |> >it makes no difference when I commented out the mfrow bit. |> > |> >I'm not very familiar with the workings of Markdown or Rstudio, but it |> >does seem strange to me that I need to specifically load the global |> >environment otherwise it's not visible. Is that to be expected? |> > |> >Ideas welcome, particularly about scaling. |> |> -- |> Sent from my phone. Please excuse my brevity. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
I've simplified it so that it's reproducible: --- title: "Barking up the wrong tree" author: "Patrick Connolly" date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" output: ioslides_presentation: default slidy_presentation: default beamer_presentation: default --- ```{r global_options, echo=FALSE} knitr::opts_chunk$set(tidy=TRUE, warning=FALSE, message=FALSE, cache=FALSE, dpi = 300) ``` ## 6 different Regression Trees ```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width = 7, fig.height = 5} par(mfrow = c(2, 3)) plot(1:10) plot(12:4) plot(seq(0, 800)) plot(-100:-900) plot(12:50) plot(90:54) ``` I've tried it on a different machine which gives a slightly more informative message: X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12 could not be loaded That seems to be associated with the Cairo plotting device which isn't necessary with pdf devices which I normally use, nor, it would seem by the plot pane in Rstudio. Consequently, running the plot code itself works fine, but if is to be incorporated in HTML, we run into the Cairo issue, Looking into that one, it appears something has been orphaned for a couple of years. If anyone has information about that, I'd be interested. TIA ------------- version 3.5.0 (2018-04-23) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS Matrix products: default BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C LC_TIME=en_NZ.UTF-8 [4] LC_COLLATE=en_NZ.UTF-8 LC_MONETARY=en_NZ.UTF-8 LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] utils stats grDevices graphics methods base other attached packages: [1] sp_1.3-1 lattice_0.20-35 loaded via a namespace (and not attached): [1] Rcpp_0.12.17 knitr_1.20 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.4 munsell_0.5.0 [7] colorspace_1.3-2 xtable_1.8-2 R6_2.2.2 rlang_0.2.1 stringr_1.3.1 plyr_1.8.4 [13] dplyr_0.7.6 tools_3.5.0 grid_3.5.0 htmltools_0.3.6 crosstalk_1.0.0 rprojroot_1.3-2 [19] yaml_2.1.19 leaflet_2.0.1 assertthat_0.2.0 digest_0.6.15 tibble_1.4.2 bindrcpp_0.2.2 [25] shiny_1.1.0 purrr_0.2.5 later_0.7.3 htmlwidgets_1.2 promises_1.0.1 evaluate_0.10.1 [31] glue_1.2.0 mime_0.5 rmarkdown_1.10 stringi_1.2.3 compiler_3.5.0 pillar_1.2.3 [37] backports_1.1.2 scales_0.5.0 httpuv_1.4.4.2 pkgconfig_2.0.1>On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote: |> This is not reproducible because you have not provided the plot code or sample data. Output of sessionInfo would probably be appropriate as well. |> |> As to whether needing to load objects is typical... yes, rmarkdown runs from a fresh environment to emphasize reproducibility, but your load command is bypassing that for us. |> |> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly <p_connolly at slingshot.co.nz> wrote: |> >I'm having difficulty getting plots into ioslides. [...] -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.