PatternFilling

PatternFilling[obj]

is a two-dimensional graphics directive specifying that obj should be used to fill faces of polygons and other filled graphics objects.

PatternFilling["name"]

uses the specified pattern "name".

PatternFilling[obj,size]

specifies the size of the object obj.

PatternFilling[obj,size,{dx,dy}]

moves the object obj by the offset {dx,dy}.

Details

  • PatternFilling is also known as rectangular tiling.
  • PatternFilling is typically used to fill polygons and areas with repeated rectangular patterns.
  • Possible patterns include:
  • PatternFilling[{"name",style,color},] specifies that faces of filled graphics objects are to be drawn using the predefined pattern "name" with the specified style and background color.
  • In PatternFilling[obj,], the object obj can be a 2D graphic or an image.
  • With PatternFilling[obj,{w,h}], the object obj will always be drawn in a w×h region and will be sized to fit in the region.
  • PatternFilling[obj,{w,h},{dx,dy}] moves obj by the absolute offset {dx,dy} in the whole w×h region.
  • ImageScaled can be used to specify the size and is taken to be fractions of the default image size.
  • PatternFilling[obj] is effectively equivalent to PatternFilling[obj,ImageScaled[.2]].
  • PatternFilling[obj] is equivalent to PatternFilling[Rasterize[obj]] and will rasterize obj at the size and resolution it would normally be displayed in a notebook.

Examples

open allclose all

Basic Examples  (3)

Apply a checkerboard pattern to a disk:

Fill between two curves:

Show a map of the US with its flag:

Scope  (13)

Basic Uses  (6)

Apply pattern filling to graphics primitives:

Apply pattern filling to a plot:

Apply pattern filling to a chart:

Style a geometric region:

Show a schematic outline map:

Summary box:

Specification  (7)

PatternFilling works on 2D graphics:

PatternFilling using 2D images:

Predefined patterns:

Style a predefined pattern:

Add a background:

Pattern sizes by a fraction of the whole image:

Patterns with absolute sizes:

Offset patterns:

Applications  (7)

Design Patterns  (6)

A checkerboard pattern:

Filling a rectangle:

A circle pattern:

Filling a regular polygon:

A diamond pattern:

Filling a regular polygon:

A space-filling curve:

Filling an annulus:

A hatch pattern:

Fill between two curves:

A crosshatch pattern:

Fill to the axis:

Transforming Patterns  (1)

Show a map with a motif:

Use a transparent background:

Introduced in 2020
 (12.1)