0
$\begingroup$

I am trying to create a 3D scatter plot, where each point is colored according to a fourth parameter (not corresponding to any of the values on the axes). To do this, I generated a list of colors, which I was going to map onto the set of points using the PlotStyle option. However, although I am correctly generating a list of colors (Which are different--I checked this!), all of my points are being assigned the same color.

I was hoping someone could help me out! I pasted my code below (I added it as an image so it would be easier to see the problem, but I can also paste the code if needed!).

$\endgroup$
4
  • 1
    $\begingroup$ Edit your question to include your code in a copy and pasteable form (InputForm in a code block) rather than an image -- particularly an image too small to be read. $\endgroup$
    – Bob Hanlon
    Commented Sep 21, 2021 at 3:24
  • 1
    $\begingroup$ Use Graphics3D[{Point[listOfPoints, VertexColors -> listOfColors]}] $\endgroup$
    – Carl Woll
    Commented Sep 21, 2021 at 4:26
  • $\begingroup$ Or wrap each point in its own list: ListPointPlot3D[Transpose@{First@WCParamDataFunction[]}, PlotStyle -> ...]. $\endgroup$
    – Domen
    Commented Sep 21, 2021 at 12:06
  • $\begingroup$ Thanks so much! $\endgroup$ Commented Sep 21, 2021 at 15:53

1 Answer 1

1
$\begingroup$

I'll move the answer here so it shows up as resolved!

Domen's suggestion to wrap each point in a list worked!

ListPointPlot3D[Transpose@{First@WCParamDataFunction[]}, PlotStyle -> ...]

I wonder why this is?

$\endgroup$
1
  • $\begingroup$ ListPointPlot3D uses one color for each data set, so you need to make each point its own data set. $\endgroup$
    – Chris K
    Commented Sep 21, 2021 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.