R API bug: single-entry color groups omitted from 3D scatter plot

Using the most recent R API (2.0.16), points get ommitted from 3D scatter plots if they’re the only member of a color group. For example, there are no zebras in the plot produced with the following code:

three_dee_data <- data.frame(
  x = 1:10,
  y = sample(1:10, 10),
  z = sample(1:10, 10),
  color = factor(c('mouse','mouse','mouse','dog','dog','dog','cat', 'cat', 'cat', 'zebra'))
)

plot_ly(
  three_dee_data,
  x = x,
  y = y,
  z = z,
  type = "scatter3d", 
  mode = "markers",
  color = color
)

… but it works fine as long as there’s more than one zebra:

    three_dee_data <- data.frame(
      x = 1:10,
      y = sample(1:10, 10),
      z = sample(1:10, 10),
      color = factor(c('mouse','mouse','mouse','dog','dog','dog','cat', 'cat', 'zebra', 'zebra'))
    )

Is there a work-around?

Thanks,

Jon

Thanks for reporting this issue! There’s an R API bug so scatter3d traces won’t work if there’s just a single point. An immediate work around would be to send the figure to Plotly i.e

  three_dee_data,
  x = x,
  y = y,
  z = z,
  type = "scatter3d", 
  mode = "markers",
  color = color
)```
then
`plotly_POST(p)`

and the trace should appear. There's an issue [here](https://github.com/ropensci/plotly/issues/415) - this should be resolved soon so no workaround is needed.

Okay great- thank you!