3
$\begingroup$

want to plot some rays with "warm" colors, so I started with a radial ray with a few points.

ray = Flatten[ Table[{r Cos[Theta], r Sin[Theta]}, {r, 0, 1, 0.1}, {Theta, 0.7, 0.7}], 1];

After reading mathematica help I believe the result of this command

ColorData[{"SiennaTones", "Reverse"}][#/(Max[ray[[All, 2]]])] & /@ ray[[All, 2]]

is going to inform me of the colors that the 11 points in the initial list will have when using that command as an option to ListPlot. That command produces an array of colors covering the whole range of SiennaTones, which range from whiteish to brown. So I do it like this:

ListPlot[
   ray, 
   PlotStyle -> (
      {PointSize[0.01], ColorData[{"SiennaTones", "Reverse"}][#]} & /@ ray[[All, 2]]
   )
]

And all I get are whiteish points. Can anybody kindly help me?

Thanks,

Ruth

$\endgroup$

1 Answer 1

4
$\begingroup$

You are close:

ray = Flatten[ Table[{r Cos[Theta], r Sin[Theta]}, {r, 0, 1, 0.1}, {Theta, 0.7, 0.7}], 1];
style = ColorData[{"SiennaTones", "Reverse"}][#/(Max[ray[[All, 2]]])] & /@ ray[[All, 2]];

ListPlot[ Style[ #1, #2]& @@@ Transpose@{ray,style} ]

Colored Rays

Or shorter:

ListPlot[ List /@ ray, PlotStyle -> style ]

The problem with what you have tried is, that a list of points is treated as one set which only has one color. Thus you have to make each point a list of its own.

$\endgroup$
2
  • $\begingroup$ Thanks a lot, very informative answer. I used to learn a lot with this forum. Love to be back into business. $\endgroup$ Commented Oct 26, 2018 at 12:54
  • 1
    $\begingroup$ @Ruth Great to hear that I could help. Do not forget to (eventually) accept an answer. ;-) $\endgroup$
    – gwr
    Commented Oct 26, 2018 at 13:37

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.