sofia
(Sofia Figueiredo)
May 20, 2015, 9:16am
1
Dear Community,
I created a table of several ParametricPlots, such as:
Table[ParametricPlot[{j Sin[u], j Sin[2 u]}, {u, 0, 2 Pi},
PlotRange → All, AspectRatio → 1], {j, 0.1, 101, 10}]
and I want that each parametric plot has a different color for each iteration.
Can you please tell me how can I do it?
I have tried ColorFunction → Function[{j}, Hue[j]] with no success
Many thanks in advance,
Sofia
seanc
(Sean Clarke)
May 20, 2015, 3:44pm
2
Take a look at the output of Hue in your Table:
Table[Hue[j], {j, 0.1, 101, 10}]
Hue needs a value between 0 and 1. It doesn’t know what to do with values outside that range. So let’s divide j by 101 so that the values go from 0 to 1. This makes a rainbow
Table[Hue[j/101], {j, 0.1, 101, 10}]
Try using PlotStyle → Hue[j/101]:
Table[ParametricPlot[{j Sin[u], j Sin[2 u]}, {u, 0, 2 Pi},
PlotStyle -> Hue[j/101], PlotRange -> All, AspectRatio -> 1], {j,
0.1, 101, 10}]
ColorFunction can also be used but is more complicated. It controls the color based on the “x, y” values of the plot.