# 2D Scatter plot with z-value used for PlotLegends I have a data set that can be generated as follows:

x=RandomReal[{1,5},100];
y=RandomReal[{11,50},100];
z=RandomReal[{7,25},100];


For each of the (x,y,z) 3-tuple, I want to make a 2D scattered plot of x vs. y and put a plot legend of z values in color bar with the figure as shown in the example image above.

I have used

ListLogLogPlot[Table[{x[[i]],y[[i]],z[[i]]},{i,Length@data], PlotLegends-> Automatic]

but cannot get what I want. Earlier, I used ListContourPlot, it was quite easy there but now I want a scattered plot.

How can I do it?

• ListPointPlot3D[Transpose@{x, y, z}, PlotLegends -> Automatic] Jun 19 at 11:34
• I don't want a 3D plot. Jun 19 at 11:49
• ListDensityPlot[Transpose[{x, y, z}], PlotLegends -> Automatic]
– Syed
Jun 19 at 12:00
• I have modified the question. I want something like that. Jun 19 at 12:06
• BubbleChart[Partition[Transpose@{x, y, z}, 1], ChartLegends -> Automatic]? Jun 19 at 12:23

Using Graphics

Clear["Global*"]

SeedRandom;
x = RandomReal[{1, 5}, 100];
y = RandomReal[{11, 50}, 100];
z = RandomReal[{7, 25}, 100];

zRng = MinMax[z];

Legended[
Graphics[{AbsolutePointSize,
{ColorData[{"SolarColors", "Reverse"}][Rescale[#[], zRng]],
Tooltip[Point@Most@#, NumberForm[#, {5, 1}]]} & /@
Transpose[{x, y, z}]},
Frame -> True,
FrameLabel -> (Style[#, 14] & /@ {HoldForm[x], HoldForm[y]}),
AspectRatio -> 1],
BarLegend[
{{"SolarColors", "Reverse"}, zRng},
LegendLabel -> Style[HoldForm[z], 14]]] • This is exactly what I wanted. Thank you Bob. Jun 22 at 10:12
SeedRandom;
x = RandomReal[{1, 5}, 100]; y = RandomReal[{11, 50}, 100]; z =
RandomReal[{7, 25}, 100];

BubbleChart[Transpose[{x, y, z}],
ColorFunction -> (ColorData[{"SolarColors", "Reverse"}][#3] &)
, ChartLegends ->
Placed[BarLegend[{ColorData[{"SolarColors", "Reverse"}],
MinMax[z]}], After]
] • Add: , BubbleSizes -> {0.04, 0.04}` if you require all bubbles to be the same size; although, this would instantly defeat the purpose of the bubble chart.
– Syed
Jun 19 at 21:03