I created a 3D scatter plot using plotly in R but I have trouble adding more data to the 3D plot.
library(plotly)
names(b) <- c('m1','m2','m3','clust')
umap_1 <- b$m1
umap_2 <- b$m2
umap_3 <- b$m3
clust <- b$clust
palette <- c('#e86e41','#d9b53f','#9857ba','#57ba64','#57b7ba')
p <- plot_ly(x = umap_1, y = umap_2, z =umap_3,
color = b$clust,
colors = palette,
marker = list(size = 1, width=1),
text = b$clust,
hoveringinfo = 'text'# controls size of points
)
I would like to add to this scatter plot other points with other size and color.
I thought first about adding a fifth column to my dataset and using this in marker with something like ifelse(b$V4=='something'], size=1, size=5)
but it doesn't work.
So i thought about adding element using %>% like :
p <- plot_ly(x = umap_1, y = umap_2, z =umap_3,
color = b$clust,
colors = palette,
marker = list(size = 1, width=1),
text = b$clust,
hoveringinfo = 'text'
)
p <- p >%> add_something(x,y,z, marker = list(size = 5, width=1))
But there is no function to add scatter point to a 3D plot.
Is there a way to do so ?