Embedded image lost when compiling R Markdown with Dot to HTML

52 views
Skip to first unread message

Steve

unread,
Feb 9, 2018, 11:33:45 AM2/9/18
to knitr

I am having a very strange issue when trying to create a self-contained HTML document with embedded figures generated from GraphViz Dot code blocks. I am also having a hard time producing a MWE of the error, so here is a description of what is going on:

- using R Studio (Version 1.0.143 on macOS);

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

loaded via a namespace (and not attached):
 [1] compiler_3.4.0  backports_1.1.0 magrittr_1.5    rprojroot_1.2   htmltools_0.3.6 tools_3.4.0     base64enc_0.1-3 yaml_2.1.14   
 [9] Rcpp_0.12.11    stringi_1.1.5   rmarkdown_1.5   knitr_1.16      jsonlite_1.5    stringr_1.2.0   digest_0.6.12   evaluate_0.10 


- I created an R Markdown document; here is the header section I used:

---
title: "Writeup"
author: "Me"
date: "Feb. 8, 2018"
output:
  html_document:
    fig_caption: yes
    keep_md: yes
    number_sections: yes
    toc: yes
---

- in the document, I have 3 small in-line Dot diagram code blocks, and one very large Dot diagram code block

- when I Knit to HTML, it produces the standard HTML output, along with a directory containing the images; however I assumed they are unused because typically the HTML output is in 'standalone' mode

- I emailed the HTML document to collaborators for review

- when I double checked the email attachment file on another computer, everything looks fine, except the largest of the diagrams is showing the 'broken image' icon and the image is not appearing

- I save the HTML email attachment, open it in Chrome, and the image is still not showing. When I right-click on the broken image icon in its place and 'Open Image in New Tab', I get this:

This site can’t be reached
The webpage at data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABZUAAANxCAYAAACcyFcEAAAAAXNSR0IArs4c6QAAQABJREFUeAHs3Qm8TdX///GPkFkks0yZSaZGGVIqUYpKRaNooHlQ+vYVDaI0fSmVFE2UX5EmRZFoUIRIqZBGQySZOf/9Xv/vPt9zj3vOPffec+89w2s9Hqezz95rr732c59zq89e+7MKBbxiFAQQQAABBBBAAAEE
.....
.....
RKBERABERABERABERABERABERABERABERABERABETACciprK+BCIiACIiACIiACIiACIiACIiACIiACIiACIiACIhA0QT+HwwqRodse7rcAAAAAElFTkSuQmCC might be temporarily down or it may have moved permanently to a new web address.
ERR_INVALID_URL

Any idea what might be happening? The .png embedded figures for the smaller diagrams are only 60KB, but this one is 160KB; is there a size limit? I opened the HTML document source and the base64 embedded figure code is indeed present, maybe part of it did not get saved?

When I re-compile the document locally and view the HTML output, it looks fine. I tried re-compiling the HTML, moving the HTML file, and then renaming it, and in one case the image broke again, in another case it didnt. I also tried removing all the text from the document and leaving only the images, and doing the same; in those cases the images all loaded fine. I am kind of lost as to what is going on here.

On the other hand, I have no issues if I compile to PDF.

Any ideas or suggestions? Thanks.
Reply all
Reply to author
Forward
0 new messages