简体   繁体   中英

Gradient Fill using Graphics in Mathematica

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

在此输入图像描述

Using Polygon , you can

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

Also:

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

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM