This question already has an answer here:

Suppose I have points

data = {{0,1,0},{0,0,1},{1,0,0},{0.2,0.8,0}};

And another array exists with

colours = {0.1,0.2,0.6,0.3};

I want to Plot a ListPointPlot3D of data, with colour of each point defined by colours.

I tried something like

ColorFunction-> (ColorData["Rainbow"][#1] /@ colours)];

But was unsuccessful. Any help would be appreciated!


marked as duplicate by Kuba Jan 24 at 14:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Graphics3D[ {AbsolutePointSize@12, Point[data, VertexColors -> (ColorData["Rainbow"] /@ colours) ]} ] $\endgroup$ – Kuba Jan 24 at 14:26
  • $\begingroup$ Let me know if the linked topic does not fit your needs. $\endgroup$ – Kuba Jan 24 at 14:31
  • $\begingroup$ @Kuba thanks for the idea; is it not possible/much more difficult using ListPointPlot3D? I was hoping to retain the functionality of ListPointPlot3D... $\endgroup$ – MKF Jan 24 at 14:54
  • $\begingroup$ For instance, use of BarLegends for the colours? $\endgroup$ – MKF Jan 24 at 14:56
  • $\begingroup$ You can put BarLegend["Rainbow"] next to it? Inset or whatever? $\endgroup$ – Kuba Jan 24 at 15:03

Browse other questions tagged or ask your own question.