Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer and Intelligence Suite.

Create pie chart in R the Tool

7 - Meteor

I need assistance in creating a simple pie chart in the R tool in Alteryx.


My end goal is to create a Harvey ball where the 2 colors used are red and green. Red = loss and Green = Win. (example below)

The Example I am trying to replicateThe Example I am trying to replicate



The issue I am facing is that the R Tool is not recognizing my input for the Red and Green. It outputs the colors Orange and Blue instead. (Example below).


The R Tool errorThe R Tool error

Here is my R Code:

df <- read.Alteryx("#1", mode="data.frame")

AlteryxGraph(2, width=2400, height=3000, res=300)

pie(df$Value, df$Name, main = "Banner1", col = df$Color)



18 - Pollux
18 - Pollux

Hi @agcruz 


Are your color names in lower case as in this example from


> colors = c("red", "yellow", "green", "violet", 
+   "orange", "blue", "pink", "cyan") 
> pie(school.freq,             # apply the pie function 
+   col=colors)                # set the color palette



7 - Meteor

I have used the lowercase text for the colors but still get the same error. 

7 - Meteor

I got my code to work.


I figured out that I should an extra line in R to create a field with the color selection in stead of creating the field before the R tool. The code is below.


df <- read.Alteryx("#1", mode="data.frame")

AlteryxGraph(1, width=2400, height=3000, res=300)

df$color <- ifelse(df$ColorNumber == 1,"green3","red2")

pie(df$Value, df$Name, main = df$ChartTitle, col = df$color)