# Is it possible to make the PlotRegion in graphics as a shape?

I have a specific pattern to show in Graphics and I would like to choose the PlotRegion as a shape. In other words, I would like to show part of the pattern within a specific shape such as Hexagon or Polygon.

Assume that the pattern is Rectangle, see below, and I would like to make the PlotRegion to be a Hexagon. How can I do that?

Graphics[{Pink, Rectangle[]}]


Use Transparent as a color and make a mask using it. Combine different Graphics with Show or combine the lists of graphics primitives.

Note, that this can also be done with continues Opacity and not only sharp cutoff. For example Transparent can be used in the ColorFunction of DensityPlot and then your mask can be described by a continues value function.

The mask can be constructed using RegionDifference

Show[{Graphics[{Pink, Rectangle[]}],
DiscretizeRegion[
RegionDifference[Rectangle[], Disk[{0.5, 0.5}, 0.3]],
BaseStyle -> Directive[EdgeForm[None], FaceForm[White]]]}]


If the underlying graphics you mask is a Plot-like and not a general Graphcis, one can use MeshRegion and RegionFunction. See the related Q&A.

• Can you please put an example even for a circle shape? – HD2006 Sep 14 '18 at 12:43
• @Abdullah please see the updated example. – Johu Sep 14 '18 at 12:59