I would like to be able to vary color of a graphics primitive. For starters, varying color of a Line object along it's length would be sufficient. For example, if I have a ColorDataFunction function f, the first point of the the line, the color would be f[0] and the last point f[1]. Or something similar. The only idea I got was to take ColorData[myScheme, "Image"] and transform it as needed or somehow exploit a ParametricPlot. But this both seems really clumsy. Is there a better way? Essentially, I would like something equivalent to adding a ColorFunction-like parameter to Graphics.

  • 1
    $\begingroup$ What about 31131 $\endgroup$ – Kuba Jan 5 '18 at 21:58
  • $\begingroup$ It seems that at least for Line, the VertexColors parameter does what I need. $\endgroup$ – user1747134 Jan 5 '18 at 22:06

Just use VertexColors like @Kuba said:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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