I'm trying to debug an OS specific error with xaringan
(an issue with plotly) . I was able to create the following xaringan
manhattan plot with the manhattanly
package on a Linux and Mac OS at work earlier today but it's not rendering on my Windows at home.
{r, echo = FALSE, results = TRUE, error = FALSE, message=FALSE, fig.width=15, fig.height=5}
if (!requireNamespace("manhattanly")) {
install.packages("manhattanly")
} else {
library(manhattanly)
}
manhattanly(HapMap, snp = "SNP", gene = "GENE", highlight = significantSNP)
This is my yaml
in the RMarkdown:
---
title: "Main title"
subtitle: "Subtitle"
author: "Matthew J. Oldach"
date: "2019-02-28"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: 16:9
css: ["default", "custom.css"]
---
And my options chunk:
options(htmltools.dir.version = FALSE)
First of all the strange thing is when I create standard ggplot
graphs (or any xaringan slide-deck that works, for example, the leaflet
example) I only see a large white screen with a small box in the top left. However, when I hit the "show in browser" it displays. Another SO post suggested running xaringan::summon_remark()
to fix this but it did not work for me.
Nonetheless, when trying to view the code posted above on windows I get a error/message in Firefox:
A website is slowing down your browser what would you like to do?
If I try opening this in internet explorer, chrome the same thing. As I mentioned earlier other plots, slides, etc. render, and the above worked on Linux and Mac OS earlier today.
A somewhat longer example of another plot that worked on Linux and Mac OS at work but not on windows is the following:
if (!requireNamespace("widgetframe")) {
install.packages("widgetframe")
} else {
library(widgetframe)
}
if (!requireNamespace("rgl")) {
install.packages("rgl")
} else {
library(rgl)
}
if (!requireNamespace("misc3d")) {
install.packages("misc3d")
} else {
library(misc3d)
}
if (!requireNamespace("neurobase")) {
install.packages("neurobase")
} else {
library(neurobase)
}
if (!requireNamespace("aal")) {
devtools::install_github("muschellij2/aal")
} else {
library(aal)
}
if (!requireNamespace("MNITemplate")) {
devtools::install_github("jfortin1/MNITemplate")
} else {
library(MNITemplate)
}
img = aal_image()
template = readMNI(res = "2mm")
cut <- 4500
dtemp <- dim(template)
# All of the sections you can label
labs = aal_get_labels()
# Pick the region of the brain you would like to highlight - in this case the hippocamus_L
hippocampus = labs$index[grep("Hippocampus_L", labs$name)]
mask = remake_img(vec = img %in% hippocampus, img = img)
### this would be the ``activation'' or surface you want to render
contour3d(template, x=1:dtemp[1], y=1:dtemp[2], z=1:dtemp[3], level = cut, alpha = 0.1, draw = TRUE)
contour3d(mask, level = c(0.5), alpha = c(0.5), add = TRUE, color=c("red") )
### add text
text3d(x=dtemp[1]/2, y=dtemp[2]/2, z = dtemp[3]*0.98, text="Top")
text3d(x=-0.98, y=dtemp[2]/2, z = dtemp[3]/2, text="Right")
l <- rglwidget()
frameWidget(l)
Feedback greatly appreciated.
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.2 htmltools_0.3.6 tools_3.5.2 xaringan_0.8 yaml_2.2.0
[6] Rcpp_1.0.0 rmarkdown_1.11 knitr_1.21 xfun_0.5 digest_0.6.18
[11] evaluate_0.13