500
500

Reputation: 6619

Gradient Fill using Graphics in Mathematica

How could I create the following using Rectangle[] in Graphics[]?

enter image description here

Upvotes: 6

Views: 2646

Answers (2)

Dr. belisarius
Dr. belisarius

Reputation: 61046

Also:

Graphics[Raster[{Range[100]/100}, ColorFunction -> (Blend[{White, Red}, #] &)], 
 AspectRatio -> .3, 
 Frame       -> True, 
 FrameTicks  -> None]

enter image description here

Upvotes: 5

Szabolcs
Szabolcs

Reputation: 25703

Using Polygon, you can

Graphics[{EdgeForm[Black], 
  Polygon[{{0, 0}, {3, 0}, {3, 1}, {0, 1}}, 
   VertexColors -> {White, Red, Red, White}]}]

Upvotes: 7

Related Questions