0

I have a number of plots using {ggplot2} and {ggiraph} that I have consolidated into a {flexdashboard}

Before attempting to display them with the dashboard, these plots displayed correctly on RStudio's viewer using the sizing option width = 0.7

However, they do not display on the dashboard (just a blank panel), and now produce a blank panel if run directly in RStudio. After some investigation it seems that some setting has changed and that the charts are not output because the size is inconsistent with the window.

If I change the width setting to 10 it displays correctly in the RStudio viewer which seems odd.

I have a small reprex here:

library(ggplot2)
library(ggiraph)

#dummy dataframe
df <- data.frame(
  x = seq.Date(Sys.Date() - 30, Sys.Date() - 1, by = "days"),
  y = runif(30, 0, 2) 
)

p <- ggplot2::ggplot(df, (aes(x,y)))+
  geom_point_interactive(aes(tooltip = x, data_id = x))


plot <- girafe(ggobj = p, 
                width =0.7)

print(plot)

This produces the following output:

width set at 0.7

However if I adjust width setting to 10

plot <- girafe(ggobj = p, 
                width =10)

print(plot)

I get the following:

width set to 10

This seems inconsistent with the documentation for {ggiraph}, is there some graphics setting that has been modified by {flexdashboard}? I've tried interactive (js) charts with {plotly} and {echarts4r} on {flexdashboard} output which don't show the same behaviour.

I'm using RStudio 1.4.1103 R version 4.0.2 System: x86_64-apple-darwin17.0

Phil
  • 7,287
  • 3
  • 36
  • 66
  • @Phil, since this question has to do with the RStudio Viewer (amongst others), I think the RStudio tag is actually relevant. – Andrew Fraser Feb 16 '21 at 07:34
  • Your issue is actually related to `ggiraph` itself. I just happens to be displayed in the RStudio viewer. – Phil Feb 16 '21 at 16:26
  • Well no, the behaviour changes in the RStudio viewer. That might have something to do with idiosyncrasies of the viewer itself. That's the reason for adding the tag. – Andrew Fraser Feb 17 '21 at 07:45

1 Answers1

1

I've been experimenting and it seems that I can control the output by using width_svg consistently.

I still don't know why there is an issue but I suspect some underlying graphics setting.