Hi,
Apologies for asking but I was hoping that someone here might have already used the R Tool for producing charts and might show me how it is done. I have attached an example but don't seem to be able to reproduce the inbuilt Charting tools output. I am hoping that once I can see it in action that I will be able to move on myself.
Many thanks in advance,
Peter
Solved! Go to Solution.
I'm not sure if the following will work for your needs, but the "pie" command in R will generate a pie chart in fairly straight-forward fashion.
For more info on that, see here: https://www.tutorialspoint.com/r/r_pie_charts.htm
Plotly is becoming popular now also: https://plot.ly/r/pie-charts/
For simplicity, I focus on the first option, rather than plotly, in the attached workflow. The workflow uses a BlockUntilDone tool to run the R script which stores the chart as a .png; then the next step grabs the PNG and renders the image, similar to what you had in your stream. (But if the .PNG suits your needs, then you could just run straight into the R tool and call it done).
Hope that helps!
John
Hi,
Many thanks for the prompt and great response. I was hoping that someone might show me how to unleash the complete power of R graphics by showing how to specify some of the options such as colour and size.
Kind regards,
Peter
Hi,
Many thanks for that. One question though, why are solutions based on saving the R output as an image rather than using a tool output channel?
Kind regards,
Peter
A-ha, I learned something new today. Replace the code in the R tool with the following, and the #1 output will contain the plot in-line.
With that, you can remove the block-until-done, etc... and just run the R-tool inline with everything else.
#install.packages("RColorBrewer") library("RColorBrewer") #pd = pie data pd <- read.Alteryx("#1", mode="data.frame") #po - pie options po <- read.Alteryx("#2", mode="list") c <- brewer.pal(n=nrow(pd),name=po$pal) AlteryxGraph(1, width=po$length, height=po$width) #Insert code to plot graph here pie(pd$NoOfAccounts, pd$BusinessUnit, col=c) invisible(dev.off())
(Also working on a plotly version; will post once it works inline).
Edit: plotly from the R tool is a no-go for the time being...)
Thanks,
John
Hi,
Me too thanks to you!
Have a great festive break,
Peter
Hi, thanks a lot for your post. I would like to create an interactive graph thanks to the R tool. The graph output is working with a "simple" ggplot graph, but it fails if I add the ggplotly function to make it become interactive. I think this corresponds to your option 2.
Can someone help me to solve this issue, please?