3
$\begingroup$

I would like to color gradient (Red to Blue) the following curve:

gr = Graphics[{Arrow[BezierCurve[{{0, 3}, {.8, 2}, {1.8, 1.7}}]]}]

Any help will be appreciated.

$\endgroup$
4
  • 1
    $\begingroup$ Graphics[{Antialiasing -> True, Arrow[Line[ BezierFunction[{{0, 3}, {.8, 2}, {1.8, 1.7}}] /@ Subdivide[50], VertexColors -> (Blend[{Red, Blue}, #] & /@ Subdivide[50])]]}]? $\endgroup$ – kglr Sep 29 '20 at 0:53
  • $\begingroup$ @kglr Exactly what I was looking for. $\endgroup$ – Mark Robinson Sep 29 '20 at 1:18
  • $\begingroup$ @kglr Can the arrow also be made of blue color? $\endgroup$ – Mark Robinson Sep 29 '20 at 1:20
  • 1
    $\begingroup$ @kglr Got the arrow part. $\endgroup$ – Mark Robinson Sep 29 '20 at 1:22
3
$\begingroup$
Graphics[{Antialiasing -> True, Blue, AbsoluteThickness[2], 
  Arrowheads[.05], 
  Arrow[Line[BezierFunction[{{0, 3}, {.8, 2}, {1.8, 1.7}}] /@ Subdivide[100], 
    VertexColors -> (Blend[{Red, Blue}, #] & /@ Subdivide[100])]]}]

enter image description here

To get a smoother look Rasterize using a large ImageSize and resize using Magnify:

Magnify[Rasterize[
  Graphics[{Antialiasing -> True, Blue, AbsoluteThickness[20], 
    Arrowheads[.05], 
    Arrow[Line[BezierFunction[{{0, 3}, {.8, 2}, {1.8, 1.7}}] /@ Subdivide[100],
       VertexColors -> (Blend[{Red, Blue}, #] & /@ Subdivide[100])]]}], 
  ImageSize -> 5000], .1]

enter image description here

$\endgroup$

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.