Closed gabprg closed 6 years ago
Any updates or temporary fixes for this issue?
Please provide a minimal reproducible example. Thanks
https://github.com/r-hopper/issues/tree/master/googleVis
Please find examples of rmd HTML renderings with and without the Sankey plot. You can see that once the Sankey plot is added, it reduces the body text to an extremely small font.
I was directed to this issue from this post: https://github.com/rstudio/rmarkdown/issues/415
Hi there,
This is helpful! Please use the plot
command in your chunks to display gvis
chart instead of print.
At the top you set the plot tag option:
options(gvis.plot.tag='chart')
The following works fine for me:
> ---
> title: "Issue_72_Example_With_Sankey"
> output:
> html_document:
> self_contained: no
> ---
>
> ```{r setup, include=FALSE}
> knitr::opts_chunk$set(echo = TRUE)
> ```
>
> ## R Markdown
>
> Body text example
>
> ```{r load}
> library(googleVis)
> options(gvis.plot.tag='chart')
>
> dat <- data.frame(From=c(rep("A",3), rep("B", 3)),
> To=c(rep(c("X", "Y", "Z"),2)),
> Weight=c(5,7,6,2,9,4))
>
> plot(dat$From, dat$Weight)
> ```
>
> More body text
>
> ```{r pressure, echo=FALSE, results='asis'}
> sk1 <- gvisSankey(dat, from="From", to="To", weight="Weight")
> plot(sk1)
> ```
Thanks very much! So obvious in retrospect :)
When using googleVis in rmarkdown to plot a table, it causes the text body font to change in the entire html output document. It seems like this might be a consequence of what the html wrapper does, since the text in my html document after adding the googleVis chart matches the one from the table captions. Is there any way to change this, such that it only applies to the specified code chunk?