# Colorbar doesn't appear

I have a list of data with dimensions $(2000,4)$.

I plotted it using ListPointPlot3D, setting the fourth dimension as the color. As follows:

ListPointPlot3D[List /@ data[[All, {1, 2, 3}]],
PlotStyle -> ({PointSize[Large],
Blend[{{0, Darker[Green]}, {5, Yellow}, {10, Red}}, #1]} & /@
Flatten[data[[All, {4}]]]), RotationAction -> "Clip"]


I want to show the colorbar, I tried the function ShowLegend, but it didn't work. Any ideas?

-

Assuming you have version 9, which has new legending functions, this is how I would do it.

data = Flatten[
Table[{x, y, Sin[ x y/50], Cos[x y/50]}, {x, 0,
10 π, π/10}, {y, 0, 10 π, π/10}], 1];

ListPointPlot3D[data[[All, {1, 2, 3}]],
ColorFunction -> Function[{x, y, z}, ColorData["IslandColors"][z]],
PlotLegends -> BarLegend[{ColorData["IslandColors"], {-1, 1}}]]


ShowLegend is a function from the old and much deviled PlotLegends package. If you intended to use that, you may have forgotten to include the package using Needs.

In earlier versions you would write something like:

Needs["PlotLegends"]

ShowLegend[
ListPointPlot3D[data[[All, {1, 2, 3}]],
ColorFunction ->
Function[{x, y, z},
ColorData["IslandColors"][z]]], {ColorData["IslandColors"][
1 - #1] &, 10, " 1", "-1", LegendPosition -> {1.1, -.4}}]


Much of what you wrote yourself doesn't seem to make sense. The List/@ part is unnesessary as you can see from how I handle the data matrix. PlotStyle` doesn't take a pure function as argument. Where did you encounter a construction like that?

-
I found it here: mathematica.stackexchange.com/questions/20023/…, in the second answer. – flaviotruzzi Apr 19 '13 at 13:44