0

I'm trying to change the color using a specific column (characters) with plot3d (rgl), but it don't change color and just show white spheres. I used col=as.numeric() because saw a example with this. The only message I get is

NAs introduced by coercion.

I'm working with R notebook.

library("rgl")
with(inventory_wop,
plot3d(dbh1.a,ht,wd, 
xlab = "Diameter",
ylab="Height",
zlab="Wood density",
type="s",
size = 0.5,
col=as.numeric(site)))

rglwidget()
Werner Hertzog
  • 2,002
  • 3
  • 24
  • 36
  • 1
    You need to include your dataset. I'm guessing that `site` is a character column in `inventory_wop`, and `as.numeric(site)` returns `NA`, because the characters don't form numbers. You may need to convert to a factor first. – user2554330 Sep 25 '20 at 18:32
  • you could try `col=factor(site)` – Ben Bolker Dec 06 '20 at 17:07

0 Answers0