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.
Requirements
- A Displayr document containing a traditional correspondence analysis.
Method
1. Select Anything > Calculation > Custom Code from the toolbar.
2. Click onto the page to place the custom calculation.
3. Paste the following code into the R Code editor.
rc = my.ca$row.coordinates
cc = my.ca$column.coordinates
library(plotly)
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)[1]),
yaxis = list(title = colnames(rc)[2]),
zaxis = list(title = colnames(rc)[3]),
aspectmode = "data"),
margin = list(l = 0, r = 0, b = 0, t = 0))
p$sizingPolicy$browser$padding <- 0
my.3d.plot = p
4. Replace my.ca in the first two lines of code with the name of your correspondence analysis. By default, it is called correspondence.analysis, but it can have numbers added to the end of the object name if you have created multiple correspondence analysis outputs. You can get the output name by clicking on the original correspondence analysis and then going to General > Name in the object inspector.
5. Click the Calculate button.
Next
How to Do Traditional Correspondence Analysis
How to Add Images to a Correspondence Analysis Map
How to Do Correspondence Analysis of a Square Table
How to Create a Quality Table From a Correspondence Analysis