LinearGradientFilling
✖
LinearGradientFilling
is a two-dimensional graphics directive specifying that faces of polygons and other filled graphics objects are to be drawn using a progressive transition between colors coli along a straight horizontal line.
uses the colors coli at the scaled positions posi.
draws along the straight line with a direction dir.
uses the specified padding when drawing beyond the boundary positions pos1 and posn.
Details




- LinearGradientFilling is also know as linear, horizontal, vertical or angular gradient.
- LinearGradientFilling is typically used to fill a region with a range of position-dependent colors.
- LinearGradientFilling[{col1,col2,…,coln}] specifies a progressive transition between coli along the x axis of the bounding box of a graphic object.
- LinearGradientFilling[] is effectively equivalent to LinearGradientFilling[{Black,White}].
- LinearGradientFilling["scheme"] uses the specified color scheme in ColorData.
- LinearGradientFilling[{pos1,pos2,…,posn}{col1,col2,…,coln}] specifies colors coli to use at the scaled position posi taken to be relative to the width of the graphic object.
- ImageScaled can be used to specify the position posi and is taken to be fractions of the whole image region.
- LinearGradientFilling[{pos1col1,pos2col2,…}] is equivalent to LinearGradientFilling[{pos1,pos2,…}{col1,col2,…}].
- LinearGradientFilling[{{pos1,col1},{pos2,col2},…}] is equivalent to LinearGradientFilling[{pos1,pos2,…}{col1,col2,…}].
- With a numerical value θ, LinearGradientFilling[…,θ] specifies the straight line with angle θ and the orientation of the gradient in direction vector {Cos[θ],Sin[θ]}.
- Possible symbol directions dir in LinearGradientFilling[…,dir] include:
-
Bottom from top to bottom Center from bottom left to top right Left from right to left Right from left to right Top from bottom to top - LinearGradientFilling[colors] is effectively equivalent to LinearGradientFilling[colors,Right].
- LinearGradientFilling[{pos1,…,posn}{col1,…,coln},dir,padding] specifies the padding to use when drawing beyond the original range of positions between pos1 and posn.
- Possible settings for padding include:
-
"Fixed" repetitions of the colors "Periodic" cyclic repetitions of all the colors "Reflected" reflections of the colors - LinearGradientFilling[colors,dir] is effectively equivalent to LinearGradientFilling[colors,dir,"Fixed"].



Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Apply a linear gradient filling to a rectangle:

https://wolfram.com/xid/0bh1tpcwna3nky-sa48r0

Fill from a curve to the axis:

https://wolfram.com/xid/0bh1tpcwna3nky-ytxyzg

A linear gradient filling of the US map:

https://wolfram.com/xid/0bh1tpcwna3nky-qmvwjy

Scope (14)Survey of the scope of standard use cases
Basic Uses (6)
Apply gradient filling to graphics primitives:

https://wolfram.com/xid/0bh1tpcwna3nky-qhy4gb

Apply gradient filling to a plot:

https://wolfram.com/xid/0bh1tpcwna3nky-tfy4et

Apply gradient filling to a chart:

https://wolfram.com/xid/0bh1tpcwna3nky-5sfuxi


https://wolfram.com/xid/0bh1tpcwna3nky-7dmsq2


https://wolfram.com/xid/0bh1tpcwna3nky-c2sv9q


https://wolfram.com/xid/0bh1tpcwna3nky-33y5w5

Specifications (8)
LinearGradientFilling with no arguments draws a progressive transition from Black to White:

https://wolfram.com/xid/0bh1tpcwna3nky-ekn68g


https://wolfram.com/xid/0bh1tpcwna3nky-86wsnz

Specify the scaled position of each color:

https://wolfram.com/xid/0bh1tpcwna3nky-4oyf33

Scaled positions are taken to be relative to the width of the graphic objects:

https://wolfram.com/xid/0bh1tpcwna3nky-wusqqm

Specify color positions by fractions of the whole image:

https://wolfram.com/xid/0bh1tpcwna3nky-utlizy

Use predefined color schemes from ColorData:

https://wolfram.com/xid/0bh1tpcwna3nky-t7qxh

Draw a linear gradient at an angle θ in radians:

https://wolfram.com/xid/0bh1tpcwna3nky-0v9slk


https://wolfram.com/xid/0bh1tpcwna3nky-iesl4j


https://wolfram.com/xid/0bh1tpcwna3nky-xxly7t

Specify what padding when drawing beyond the bounding positions:

https://wolfram.com/xid/0bh1tpcwna3nky-u59hss

Applications (13)Sample problems that can be solved with this function
Basic Applications (3)
Show gradient colors and their positions:

https://wolfram.com/xid/0bh1tpcwna3nky-yhlprw
Progressive transition between colors at 0 and 1:

https://wolfram.com/xid/0bh1tpcwna3nky-53dp2e


https://wolfram.com/xid/0bh1tpcwna3nky-hecu5j


https://wolfram.com/xid/0bh1tpcwna3nky-9jsvwp


https://wolfram.com/xid/0bh1tpcwna3nky-uhgs6l

https://wolfram.com/xid/0bh1tpcwna3nky-ojug4b

Show gradient colors and padding:

https://wolfram.com/xid/0bh1tpcwna3nky-5q367x

https://wolfram.com/xid/0bh1tpcwna3nky-koly3z


https://wolfram.com/xid/0bh1tpcwna3nky-4r6ftw


https://wolfram.com/xid/0bh1tpcwna3nky-37wab1

Gradient Colors (3)
Collection of gradient colors in ColorData:

https://wolfram.com/xid/0bh1tpcwna3nky-7hjbon


https://wolfram.com/xid/0bh1tpcwna3nky-cks6ao

https://wolfram.com/xid/0bh1tpcwna3nky-wpt7e7

Collection of gradient colors in the Wolfram Data Repository:

https://wolfram.com/xid/0bh1tpcwna3nky-dx3mx0

https://wolfram.com/xid/0bh1tpcwna3nky-nazjvm


https://wolfram.com/xid/0bh1tpcwna3nky-xn7see

https://wolfram.com/xid/0bh1tpcwna3nky-pfuprt

Collection of hue colors in the Wolfram Data Repository:

https://wolfram.com/xid/0bh1tpcwna3nky-lgyhfv

https://wolfram.com/xid/0bh1tpcwna3nky-17deud


https://wolfram.com/xid/0bh1tpcwna3nky-zs26m2

https://wolfram.com/xid/0bh1tpcwna3nky-dbqzoh

Graphics (3)
Apply gradient fillings to graphics primitives:

https://wolfram.com/xid/0bh1tpcwna3nky-xq2euk

Apply gradient fillings to Text:

https://wolfram.com/xid/0bh1tpcwna3nky-55fk17

https://wolfram.com/xid/0bh1tpcwna3nky-bbo5w4

Add a gradient background to graphics objects:

https://wolfram.com/xid/0bh1tpcwna3nky-yf092g
A graphics object with a gradient background:

https://wolfram.com/xid/0bh1tpcwna3nky-ralsy4


https://wolfram.com/xid/0bh1tpcwna3nky-f56i97


https://wolfram.com/xid/0bh1tpcwna3nky-gqlpom

Visualization (4)
Plot with a background gradient:

https://wolfram.com/xid/0bh1tpcwna3nky-2r0h1d


https://wolfram.com/xid/0bh1tpcwna3nky-xvvxq9


https://wolfram.com/xid/0bh1tpcwna3nky-ll49nz


https://wolfram.com/xid/0bh1tpcwna3nky-6owkj6

Properties & Relations (5)Properties of the function, and connections to other functions
LinearGradientFilling uses the color space of the specified colors:

https://wolfram.com/xid/0bh1tpcwna3nky-ie1k2c

The linear gradient with colors in HSB color space:

https://wolfram.com/xid/0bh1tpcwna3nky-owiz1o

Different colors can be given at a single position to generate hard stops:

https://wolfram.com/xid/0bh1tpcwna3nky-sgf0fd

LinearGradientImage returns an image with linear blend of colors:

https://wolfram.com/xid/0bh1tpcwna3nky-i0r36b


https://wolfram.com/xid/0bh1tpcwna3nky-lxum08

Use Blend to generate an array of blended colors:

https://wolfram.com/xid/0bh1tpcwna3nky-hdo4pi


https://wolfram.com/xid/0bh1tpcwna3nky-rf3hfz

VertexColors interpolate between colors:

https://wolfram.com/xid/0bh1tpcwna3nky-rc8kx3


https://wolfram.com/xid/0bh1tpcwna3nky-z7itd4

Possible Issues (2)Common pitfalls and unexpected behavior
When colors are specified with the same color space, that space is used for interpolation:

https://wolfram.com/xid/0bh1tpcwna3nky-catrt4

When colors are specified using different color spaces, interpolation happens in the color space of the first color:

https://wolfram.com/xid/0bh1tpcwna3nky-zka0kg

Grayscale color space is interpreted as RGB color space:

https://wolfram.com/xid/0bh1tpcwna3nky-fi61z2

Color directives are preceded by LinearGradientFilling:

https://wolfram.com/xid/0bh1tpcwna3nky-lavalf

Wolfram Research (2020), LinearGradientFilling, Wolfram Language function, https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
Text
Wolfram Research (2020), LinearGradientFilling, Wolfram Language function, https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
Wolfram Research (2020), LinearGradientFilling, Wolfram Language function, https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
CMS
Wolfram Language. 2020. "LinearGradientFilling." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
Wolfram Language. 2020. "LinearGradientFilling." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
APA
Wolfram Language. (2020). LinearGradientFilling. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LinearGradientFilling.html
Wolfram Language. (2020). LinearGradientFilling. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LinearGradientFilling.html
BibTeX
@misc{reference.wolfram_2025_lineargradientfilling, author="Wolfram Research", title="{LinearGradientFilling}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/LinearGradientFilling.html}", note=[Accessed: 08-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_lineargradientfilling, organization={Wolfram Research}, title={LinearGradientFilling}, year={2020}, url={https://reference.wolfram.com/language/ref/LinearGradientFilling.html}, note=[Accessed: 08-July-2025
]}