Amit Kohli Amit Kohli - 3 months ago 12
R Question

Increase size of chart in Azure ML R script

I am trying to see a chart that I have produced within an R script module in Azure ML. It looks like this:

enter image description here

Needless to say, this is unusably small. I am looking for something like

width
... is there anything available?

Just in case, the script looks like this:

library(GGally)
df <- dataset1
names(df) <- gsub("[- ]","x",names(df))
ggpairs(df, alpha=0.4)

Answer

One thing we can do is exporting the output plot to a pdf file and storing it to an Azure blob storage. for that you should create a blob storage in your azure storage. Then modify the script as follows.

d <- maml.mapInputPort(1)
library(GGally)
library(caTools)
pdf()
df <- d
names(df) <- gsub("[- ]","x",names(df))
d <- ggpairs(df,  alpha=0.4)
b64ePDF <- function(filename) {
                maxFileSizeInBytes <- 5 * 1024 * 1024 # 5 MB
                return(base64encode(readBin(filename, "raw", n = maxFileSizeInBytes)))
}
d2 <- data.frame(pdf = b64ePDF("Rplots.pdf"))
maml.mapOutputPort("d2");

Set your azure blob storage destination. The plot will save as a pdf. enter image description here

Comments