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

Parallel coordinates error in R

Hello, I am trying to recreate the example plots located at this link https://plot.ly/r/parallel-coordinates-plot/. When I input the example code into R, I get the following error message:

Error: Trace type must be one of the following:
‘scatter’, ‘bar’, ‘box’, ‘heatmap’, ‘histogram’, ‘histogram2d’, ‘histogram2dcontour’, ‘pie’, ‘contour’, ‘scatter3d’, ‘surface’, ‘mesh3d’, ‘scattergeo’, ‘choropleth’, ‘scattergl’, ‘scatterternary’, ‘scattermapbox’, ‘area’.

The code I used is below:

library(plotly)

p <- plot_ly(type = ‘parcoords’, line = list(color = ‘blue’),
dimensions = list(
list(range = c(1,5),
constraintrange = c(1,2),
label = ‘A’, values = c(1,4)),
list(range = c(1,5),
tickvals = c(1.5,3,4.5),
label = ‘B’, values = c(3,1.5)),
list(range = c(1,5),
tickvals = c(1,2,4,5),
label = ‘C’, values = c(2,4),
ticktext = c(‘text 1’, ‘text 2’, ‘text 3’, ‘text 4’)),
list(range = c(1,5),
label = ‘D’, values = c(4,2))
)
)
p

Was there an update to plotly that doesn’t include this trace anymore? Thanks in advance.

Cardy Moten

Hi @cmoten33, this currently only works with the dev version – devtools::install_github("ropensci/plotly")

@carson, thanks for the suggestion. That fixed the error.