Alteryx Designer

Definitive answers from Designer experts.

R Error: Error in plot.new()

Alteryx
Alteryx
Created

Issue

 

When running custom code from the R tool, the following R as shown below: Error in plot.new()

 

Error.png

 

Error in plot.new()

 

 

Cause

 

This error may occur when using the AlteryxGraph device. The reason for this is that the AlteryxGraph device creates a pipe between Alteryx and R. If creating graphs in a loop, a pipe has to be created for each loop which slows down the processing. As a result, Alteryx ends up trying to create the next graph before the previous one is completed. To avoid this, it is best practice when creating multiple graphs within a loop to keep the AlteryxGraph device statement outside of the loop.

 

Solution

 

Below is some R coding that demonstrates the cause and resolution.

 

AlteryxGraph inside the loop - Results in error:

 

x <- 1:100000
for (i in 1:10) {
  AlteryxGraph(1)
  plot(x, x)
  invisible(dev.off)
}

 

AlteryxGraph outside the loop - Does not error:

x <- 1:100000
AlteryxGraph(1)
for (i in 1:10) {
  plot(x, x)
}
invisible(dev.off)

A big thanks to @DrDan for his explanation and code samples.

Comments
5 - Atom

@DrDan, and @DanC

 

I have the following error while running the Model Comparison workflow (link: https://gallery.alteryx.com/#!app/Model-Comparison/56bbd3013df7da08b8fcd00a)

 

Note: i am using Alteryx in VirtualBox VM (Windows 10) in a Mac machine. Also, I am using Alteryx 10.6.

 

Please help. Thank you!

 

 

Picture0.png

 

Picture2.png

 

Picture1.png