How to graph a scatter plot in 3D?

To get the most out of this community, you should e familiar with this post:

To know how to create a REPRoducible EXample (reprex), please go through the following post:

Now, I can create what you want quite easily with the plot3Drgl package as follows:

# loading library
library(plot3Drgl)

# simulating co-ordinates
sim_x <- rnorm(n = 100)
sim_y <- rnorm(n = 100)
sim_z <- rnorm(n = 100)

# plotting 3D scatterplot
scatter3Drgl(x = sim_x,
             y = sim_y,
             z = sim_z,
             colvar = NULL)

I don't know how to upload an interactive plot here. If you run this, you'll get a new window where you will be able to rotate, zoom, etc. You can explore more options from the documentation.

Note that, I only plotted the points, instead of joining them. I didn't quite understand how did you plot your diagram. One of the points (labelled Sada-Melik or something like that) is connected to two points, which makes me think that you may be plotting vertices and edges separately. If you want to plot a graph, I think igraph package will be useful, but I haven't used it much.

Hope this helps.