# How to draw 3D scatter plot with sizes of points reflecting value?

I have a 3D scatter plot as below. First 3 columns of the points are the location.

BlockRandom[SeedRandom;
pts1 = RandomReal[1, {10, 4}];
pts2 = RandomReal[10, {10, 4}];
]

scatterPlot = ListPointPlot3D[{pts1[[1 ;; 3]], pts2[[1 ;; 3]]}, PlotRange -> All] As you can see, currently the size of all points are just the same. I want to make the 4th column to be the size of the points. How can I do that?

Many thanks!

The easiest way is to use BubbleChart3D:

BubbleChart3D[{pts1, pts2}] If you have to use ListPlot3D here is one way:

lpp3d = Show[ListPointPlot3D[List /@ #[[All, ;; 3]],
Rescale[#[[All, 4]], MinMax @ Join[pts1[[All, 4]], pts2[[All, 4]]], {.1, .9}/10]}],
PlotRange -> All] & @@@
Transpose[{{pts1, pts2}, {RGBColor[0.5, 0.5, 1.],  RGBColor[0.5, 1., 0.5]}}],
PlotRange -> All, BoxRatios -> 1, PlotRangePadding -> Scaled[.1]] You can post-process to turn Points into Spheres

Replace[lpp3d, {d : Directive[_, Directive[c___, PointSize[s_]]],
Point[x_]} :> {Directive[c], Sphere[x, 10 s]}, Infinity] Graphics3D[
{PointSize[ #[] /20], Point[{#[], #[], #[]}]} & /@ pts1
]