ggplot2 plots not showing up in Azure SparkR Notebooks

I've been trying out notebooks in Microsoft Fabric. More specifically in Azure Synapse (both in Data Science and Data Engineering, doesn't seem to matter which).

I've been successful in doing everything else as well as I could with Python (I'm following Microsoft Learn's Python documentation, but doing the exercise using R), but the one thing I can't seem to get working is ggplot2 plots.

I don't receive any error messages (I do get the same warning messages that I would when everything is working), but the plots just won't appear. Naturally, I checked that the code works locally in RStudio.

I've also successfully visualized data with all the different Python packages, in a separate notebook. Both are using the same default environment Runtime 1.2 (Spark 3.4 etc.). I even tried changing to Runtime 1.1 (Spark 3.3 etc.), but no change.

Hi Antti,

Could you give an example of simple code that should produce a plot, but doesn't, along with a screenshot of both the code cell and its output?

Hi David,

Here is the most simple example.

What happens if you run this in a brand new notebook?

ggplot() +
  geom_point(aes(0,0))

Again, no errors, but no output.

Thanks, Antti: I noticed that you didn't have to load any libraries to execute the code — what did you do to have SparkR recognize the ggplot() function?

I originally had this in the same cell, but split them in a different cell, because the output wasn't as clear with them in the same cell.

install.packages("ggplot2")
library(ggplot2)

I see — thanks, Antii. Since this was brand new notebook, I can only guess that there is something about your Azure Synapse settings that is preventing the plot from being rendered as output: I executed the same code in an Azure Synapse notebook of my own, and the plot was rendered as output.

At this point, it sounds like this is not an R issue, so this forum may not be of much help and I would recommend looking for help directly from Microsoft.

1 Like

Thank you, David!

I now know where to focus my energy in trying to find the solution. I will try Microsoft next.

Cheers!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.