Black Lives Matter. Please consider donating to Black Girls Code today.

Parallel coordinates for categorical data

Dear community:

I am analysing two types of variables (numerical and categorical) through a parallel coordinates plot in R by Plotly functions. I managed to reproduce the numerical variables however I am unable to reproduce a plot with both types. The categorical variable present values ranging from ‘Very low’, ‘Low’, ‘Medium’, ‘High’, ‘Very high’. here is the code:

ppp <- dff %>%
plot_ly(type = ‘parcoords’,
line = list(color = ‘blue’),
dimensions = list(
list(range = c(~min(IRH),~max(IRH)),
label = ‘IRH’, values = ~IRH),
list(range = c(0, 0.55),
label = ‘IA’, values = ~IA),
list(range = c(0, 60),
constraintrange = c(20,60),
label = ‘IUA’, values = ~IUA),
list(range = c(0, 35),
label = ‘IEAS’, values = ~IEAS),
list(range = c(0, 5),
label = ‘IASAP’, values = ~IASAP),
list(tickvals = c(‘Muy bajo’, ‘Bajo’, ‘Medio’, ‘Alto’, ‘Muy alto’),
ticktext = c(‘Muy bajo’, ‘Bajo’, ‘Medio’, ‘Alto’, ‘Muy alto’),
label=‘IVH’, values=~IVH
)
)
)

Your tickvals should be numerical, but you should have ticktext, which describes the labels. See Larger labels in Parallel Coordinates Plot for an example.

1 Like