UI issue with R plots

lkahn
New Contributor II

Starting on May 6, our workspace in ap-southeast-2 stopped being able to display R plots correctly. This is specific to this workspace (we have 3), and specific to R plots, and is occurring for all users and clusters.

The figure itself can be resized using R code (it's not an issue of the plot dimensions) but the Databricks UI is only giving the plot a tiny sliver for display, so all we see is the top sliver of the figure.

Testing it further shows that other weird things are happening – displayed dataframes are sometimes overlaid over the figure display area, and sometimes figures don’t display at all (see attached).

How can I resolve this? 

 

Lu_Wang_ENB_DBX
Databricks Employee
Databricks Employee

This looks like a workspace-side notebook UI regression. 

Recommendation

  1. Open a Databricks support ticket and treat it as a Notebook UI / rendering regression for that workspace. Include:

    • Workspace ID
    • Region: ap-southeast-2
    • Start date: May 6
    • A notebook URL
    • Screenshots
    • A HAR capture
    • The fact that it affects all users and clusters, and only R plot output in that workspace

    Ask support to check for a workspace-scoped frontend/webapp rollout or flag regression in the notebook rendering path.

  2. Use a workaround instead of inline R plot output until support fixes it. Databricks R notebooks normally capture plots as inline PNGs, and notebooks also support displayHTML() for custom HTML output.

library(ggplot2)

p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()

dir.create("/dbfs/FileStore/tmp/rplots", recursive = TRUE, showWarnings = FALSE)
fname <- sprintf("plot-%s.png", as.integer(Sys.time()))
fullpath <- file.path("/dbfs/FileStore/tmp/rplots", fname)

ggsave(fullpath, plot = p, width = 10, height = 6, dpi = 150)

displayHTML(sprintf(
  "<img src='/files/tmp/rplots/%s' style='max-width:100%%; height:auto;'/>",
  fname
))
  1. If you need an immediate operational workaround, run those R notebooks in one of your unaffected workspaces until the workspace UI issue is fixed.

View solution in original post