rich-iannone / DiagrammeR

Graph and network visualization using tabular data in R
https://rich-iannone.github.io/DiagrammeR/
Other
1.68k stars 247 forks source link

Issue exporting mermaid diagram in RStudio #87

Closed morsem closed 9 years ago

morsem commented 9 years ago

I'm using RStudio Version 0.98.1103. Nothing actually saves when I use the RStudio Export function to "Save as Image." This might be a problem on RStudio's end, or I'm just experiencing some odd quirk.

stevepowell99 commented 9 years ago

same issue here. on ubuntu 14.04 64-bit.

stevepowell99 commented 9 years ago

to clarify - markdown export works fine. export doesn't work at all. copy to clipboard sort-of works, but the screenshot missed a bit: (this is the actual content of the clipboard after clicking on "clipboard") image

rich-iannone commented 9 years ago

This has been happening to me as well for Graphviz diagrams. Saving the image doesn't actually write the file. @jjallaire : is it possible that this is a bug affecting all htmlwidgets or recent builds of RStudio? I think I was able to save images before (however, not totally sure).

jjallaire commented 9 years ago

I just tested this with the RStudio Preview build (v0.99.386, http://www.rstudio.com/products/rstudio/download/preview/) and it worked fine on Windows, Mac, and Linux. Here's the code I'm using:

library(DiagrammeR)

boxes_and_circles <- "
digraph boxes_and_circles {

# several 'node' statements
node [shape = box]
A; B; C; D; E; F

node [shape = circle,
fixedsize = true,
width = 0.9] // sets as circles
1; 2; 3; 4; 5; 6; 7; 8

# several 'edge' statements
A->1 B->2 B->3 B->4 C->A
1->D E->A 2->4 1->5 1->F
E->6 4->6 5->7 6->7 3->8

# a 'graph' statement
graph [overlap = true, fontsize = 10]
}
"

grViz(boxes_and_circles)

What platform are you on and what is the exact behavior you are seeing?

stevepowell99 commented 9 years ago

I just downloaded the latest preview v0.99.386. Now slightly different problem - clipboard and export now both work, but seem to take a screenshot but the screenshot is not quite the same area as the plot. Here I am pasting the export; the clipboard looks exactly the same. Markdown knit to html works fine.

So my problem is not quite the same as the other two colleagues.

rplot

Ubuntu 64-bit, 14.04

sessionInfo()

R version 3.1.3 (2015-03-09) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] DiagrammeR_0.5

loaded via a namespace (and not attached): [1] digest_0.6.4 htmltools_0.2.6 htmlwidgets_0.3.2 RJSONIO_1.2-0.2
[5] rstudioapi_0.2 tools_3.1.3 yaml_2.1.13

stevepowell99 commented 9 years ago

I should add this does not happen with say plot(1:10) or ggplot(1:10)

jjallaire commented 9 years ago

Hmm...this works correctly for me under the same configuration.

The way we implement this is to take a screenshot of the region of the page that corresponds to the widget image. Clearly there is some sort of offset problem here, perhaps caused by a custom Gnome/Unity theme? (just a wild guess). If you provide more info about your configuration we may still be able to reproduce locally.

On Tue, Apr 14, 2015 at 1:42 AM, Steve Powell notifications@github.com wrote:

I just downloaded the latest preview v0.99.386. Now slightly different problem - clipboard and export now both work, but seem to take a screenshot but the screenshot is not quite the same area as the plot. Here I am pasting the export; the clipboard looks exactly the same. Markdown knit to html works fine.

So my problem is not quite the same as the other two colleagues.

[image: rplot] https://cloud.githubusercontent.com/assets/3277499/7130922/df49d3c8-e280-11e4-9fef-a678d9df288d.png

Ubuntu 64-bit, 14.04

sessionInfo()

R version 3.1.3 (2015-03-09) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8

[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_US.UTF-8

[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C

[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] DiagrammeR_0.5

loaded via a namespace (and not attached): [1] digest_0.6.4 htmltools_0.2.6 htmlwidgets_0.3.2 RJSONIO_1.2-0.2

[5] rstudioapi_0.2 tools_3.1.3 yaml_2.1.13

— Reply to this email directly or view it on GitHub https://github.com/rich-iannone/DiagrammeR/issues/87#issuecomment-92614945 .

stevepowell99 commented 9 years ago

that is probably the reason - I have some kind of messed-up desktop which is mate 1.8.2 but I think it is contaminated with xfce or something like that. I will check next time I log into gnome-shell. thanks.

jjallaire commented 9 years ago

The window system measurements are probably off so when Qt goes to address a part of the Window it gets the wrong offset for the size(s) of the Window c hrome. If it's truly some sort of mal-configuration I don't know if there's a way for us to fix this.

On Tue, Apr 14, 2015 at 3:09 PM, Steve Powell notifications@github.com wrote:

that is probably the reason - I have some kind of messed-up desktop which is mate 1.8.2 but I think it is contaminated with xfce or something like that. I will check next time I log into gnome-shell. thanks.

— Reply to this email directly or view it on GitHub https://github.com/rich-iannone/DiagrammeR/issues/87#issuecomment-93023187 .

sebastiz commented 8 years ago

I get this problem too with Mac El Capitane 10.11.3 and R Studio Version 0.98.1091 and DiagrammeR 0.8.2. It only affects plots from DiagrammeR. What should I do about it?