PlotStyle according to PlotRange
You could do as in the link J.M. provided, define the plotted function as a piecewise function. But you can make a custom piecewise color function,
regions = {"0≤θ<π/3",
"π/3≤θ<2π/3",
"2π/3≤θ<π",
"π≤θ<4π/3",
"4π/3≤θ<5π/3",
"5π/3≤θ<2π"};
colors = {Red, Blue, Green, Orange, Pink, Magenta};
colorfunc[θ_] =
Piecewise[Transpose[{colors, ToExpression /@ regions}]];
and then use that on your plot. Here I'm feeding colorfunction
the value #3
which is the value of theta
(I think #1
and #2
would be x
and y
). Far as I can tell, the
ParametricPlot[Hypocycloid[{5, 1}, θ], {θ, 0, 2 Pi},
ColorFunction -> (colorfunc[#3] &),
ColorFunctionScaling -> False,
Axes -> None, Frame -> True, PlotRange -> All,
PlotLegends -> SwatchLegend[colors, regions]]