I have a 3D iterative plot, where each iteration (1,2,3) is represented by equation of piecewise linear function. I am trying to change the colors of plot, to get for every iteration (piecewise function) different color.

Here is my plot and code what I use for plotting

enter image description here

Show[Map[ParametricPlot3D[{x, maxlines[x, iterpairs[[#]]], #}, {x, 0, 
     1},BoxRatios -> {1, 1, 2}, PlotRange -> {{0, 1}, {0, 1}, {0, 3}}] &,

I was trying to add as parameter ColorFunction, but it didnt work.


Does anyone know which parameter should I add, to change the colors of this plot? Thank you for your advices.


1 Answer 1


Use something like PlotStyle -> ColorData["Rainbow"][...], e.g. (You did not show what your maxlines is, so I'm using random numbers as example)

Show[Map[ParametricPlot3D[{x, x + RandomReal[], #}, {x, 0, 1}, 
    BoxRatios -> {1, 1, 2}, PlotRange -> All, 
    PlotStyle -> ColorData["Rainbow"][#/3]] &, Range[3]]]

enter image description here


Your Answer

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

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