WOLFRAM

LinearGradientFilling[{col1,col2,,coln}]

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.

LinearGradientFilling[{pos1,pos2,,posn}{col1,col2,,coln}]

uses the colors coli at the scaled positions posi.

LinearGradientFilling[{pos1,pos2,,posn}{col1,col2,,coln},dir]

draws along the straight line with a direction dir.

LinearGradientFilling[{pos1,,posn}{col1,,coln},dir,padding]

uses the specified padding when drawing beyond the boundary positions pos1 and posn.

Details

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Apply a linear gradient filling to a rectangle:

Out[1]=1

Fill from a curve to the axis:

Out[1]=1

A linear gradient filling of the US map:

Out[1]=1

Scope  (14)Survey of the scope of standard use cases

Basic Uses  (6)

Apply gradient filling to graphics primitives:

Out[1]=1

Apply gradient filling to a plot:

Out[1]=1

Apply gradient filling to a chart:

Out[1]=1

Style a geometric region:

Out[1]=1

Show a schematic outline map:

Out[1]=1

Summary box:

Out[1]=1

Specifications  (8)

LinearGradientFilling with no arguments draws a progressive transition from Black to White:

Out[1]=1

Use a custom color sequence:

Out[1]=1

Specify the scaled position of each color:

Out[1]=1

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

Out[1]=1

Specify color positions by fractions of the whole image:

Out[2]=2

Use predefined color schemes from ColorData:

Out[1]=1

Draw a linear gradient at an angle θ in radians:

Out[1]=1

Specify the angle in degrees:

Out[2]=2

Use predefined directions:

Out[1]=1

Specify what padding when drawing beyond the bounding positions:

Out[1]=1

Applications  (13)Sample problems that can be solved with this function

Basic Applications  (3)

Show gradient colors and their positions:

Progressive transition between colors at 0 and 1:

Out[2]=2

Colors at midpoints:

Out[3]=3

Colors at random positions:

Out[4]=4

Show gradient directions:

Different angles:

Out[2]=2

Show gradient colors and padding:

Fixed padding:

Out[2]=2

Periodic padding:

Out[3]=3

Reflected padding:

Out[4]=4

Gradient Colors  (3)

Collection of gradient colors in ColorData:

Show gradients:

Out[13]=13

Collection of gradient colors in the Wolfram Data Repository:

Show gradients:

Out[4]=4

Collection of hue colors in the Wolfram Data Repository:

Show gradients:

Out[4]=4

Graphics  (3)

Apply gradient fillings to graphics primitives:

Out[1]=1

Apply gradient fillings to Text:

Out[2]=2

Add a gradient background to graphics objects:

A graphics object with a gradient background:

Out[2]=2

A graph:

Out[3]=3

A bar chart:

Out[4]=4

Visualization  (4)

Plot with a background gradient:

Out[21]=21

Fill between two curves:

Out[1]=1

Style bar charts:

Out[1]=1

Style a time series plot:

Out[1]=1

Properties & Relations  (5)Properties of the function, and connections to other functions

LinearGradientFilling uses the color space of the specified colors:

Out[1]=1

The linear gradient with colors in HSB color space:

Out[2]=2

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

Out[1]=1

LinearGradientImage returns an image with linear blend of colors:

Out[1]=1
Out[2]=2

Use Blend to generate an array of blended colors:

Out[1]=1
Out[2]=2

VertexColors interpolate between colors:

Out[1]=1
Out[2]=2

Possible Issues  (2)Common pitfalls and unexpected behavior

When colors are specified with the same color space, that space is used for interpolation:

Out[10]=10

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

Out[9]=9

Grayscale color space is interpreted as RGB color space:

Out[3]=3

Color directives are preceded by LinearGradientFilling:

Out[1]=1
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.

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 ]}

@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 ]}

@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 ]}