1
$\begingroup$

I am currently trying to visualize a scatter plot given x and y-axis from the table Data and the colors of the points I want to come from the table valuesnew.

Data = {{0.458363,0.638569},{0.853902,0.756263},{0.880396,0.411021},{0.112152,0.618945}}
valuesnew = {Red, Red, Yellow, Blue}
ListPlot[Transpose[{Data[[All,1]], Data[[All,2]]}], PlotStyle->valuesnew]

The problem is that it colors all the points only based on the last color of the list. Does anyone know how to fix this issue? Thank you!

$\endgroup$
5
  • 1
    $\begingroup$ ListPlot[Map[List, Data], PlotStyle -> valuesnew] $\endgroup$
    – LouisB
    Commented May 12, 2021 at 20:01
  • 1
    $\begingroup$ ListPlot[List /@ Transpose[{Data[[All, 1]], Data[[All, 2]]}], PlotStyle -> valuesnew]. The Yellow point is hard to see, $\endgroup$ Commented May 12, 2021 at 20:01
  • $\begingroup$ @LouisB it works thank you very much! $\endgroup$
    – mandella
    Commented May 13, 2021 at 7:24
  • $\begingroup$ @RohitNamjoshi also this approach works thank you very much! Yes you are correct I changed yellow to another color since I couldn't see it. $\endgroup$
    – mandella
    Commented May 13, 2021 at 7:25
  • $\begingroup$ try also ListPlot[Thread@Style[Data, valuesnew]]. $\endgroup$
    – kglr
    Commented May 13, 2021 at 12:24

1 Answer 1

1
$\begingroup$

You may use PointValuePlot. PointValuePlot is marked as experimental in version 12.2 so its functionality may change.

With data and valuesnew in OP, then

PointValuePlot[data -> valuesnew]

Mathematica graphics

Hope this helps.

$\endgroup$

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.