This article describes how to go from a traditional correspondence analysis:
To a 3D correspondence analysis visualization which allows you to view an extra dimension in your analysis.
A Q project containing a traditional correspondence analysis.
We now need to write a bit of code – but don’t worry! We just need to cut and paste and change a few characters.
- Go to Create > R Output.
- Copy and paste in the code shown after point 4 on this page.
- Replace my.ca with the name of your correspondence analysis. If you right-click on the correspondence analysis in the report tree and select Reference name you will find the name (you can modify the name if you wish). screen.
- Check the Automatic option at the top right of the
rc = my.ca$row.coordinates
cc = my.ca$column.coordinates
p = plot_ly()
p = add_trace(p, x = rc[,1], y = rc[,2], z = rc[,3],
mode = 'text', text = rownames(rc),
textfont = list(color = "red"), showlegend = FALSE)
p = add_trace(p, x = cc[,1], y = cc[,2], z = cc[,3],
mode = "text", text = rownames(cc),
textfont = list(color = "blue"), showlegend = FALSE)
p <- config(p, displayModeBar = FALSE)
p <- layout(p, scene = list(xaxis = list(title = colnames(rc)),
yaxis = list(title = colnames(rc)),
zaxis = list(title = colnames(rc)),
aspectmode = "data"),
margin = list(l = 0, r = 0, b = 0, t = 0))
p$sizingPolicy$browser$padding <- 0
my.3d.plot = p
You will now have a 3D plot like the one below. You can click on it, drag things around, and zoom in and out with the scroll wheel on your mouse.
Sharing your 3D scatterplot
If you export this visualization to PowerPoint it will just become a picture and will forget any changes you made. The best way to share this visualization is to export it to Displayr. Sign up is free, and allows you to create and export dashboards to web pages, which can then be shared. Click here to go into a Displayr document that contains the visualizations in this post – click the Export tab in the ribbon to share the dashboard.