# Is it possible to induce Mathematica to chop off parts of Graphics objects that exist outside of a Frame?

I am running Mathematica 7. In a Graphics environment I am setting Frame -> True (and using FrameLabel -> {"x", "y"} and PlotLabel -> "My Title", etc) so that I can see length scales in Graphics environments.

Suppose that I create a Disk of radius 0.9, centered at the origin. I have set PlotRange -> {{-1, 1}, {-1, 1}}. The result looks nice:

Graphics[{
Cyan, Disk[{0, 0}, 0.9]
},
PlotRange -> {{-1, 1}, {-1, 1}}, Frame -> True,
FrameLabel -> {"x", "y"}, PlotLabel -> "My Disk"] Now, however, suppose that I want to create a Disk that is not entirely contained in Frame. For example, I might leave PlotRange -> {{-1, 1}, {-1, 1}} and increase the Disk radius from 0.9 to 1.2. However, in the resulting image, the Disk goes beyond the boundaries of the Frame:

Graphics[{
Cyan, Disk[{0, 0}, 1.2]
},
PlotRange -> {{-1, 1}, {-1, 1}}, Frame -> True,
FrameLabel -> {"x", "y"}, PlotLabel -> "My Disk"] Is there any way that I can direct Mathematica to chop off parts of the Graphics objects that exist outside of the Frame? Thanks for your time.

If I have understood correctly then PlotRangeClipping -> True is what you need:

Graphics[{Cyan, Disk[{0, 0}, 1.2]}, PlotRange -> {{-1, 1}, {-1, 1}},
Frame -> True, FrameLabel -> {"x", "y"}, PlotLabel -> "My Disk",
PlotRangeClipping -> True] Though not strictly a way to clip graphics, a similar result for a disk can be obtained with RegionPlot which automatically frames and clips regions.

r = 1.2;
RegionPlot[x^2+y^2 <= r^2, {x,-r,r}, {y,-r,r},
PlotRange->{{-1,1},{-1,1}}, PlotLabel->"My Disk"] • The reason is still the same as in Mike's answer :) RegionPlot just has it set to True by default. See Options[RegionPlot, PlotRangeClipping] and Options[Graphics, PlotRangeClipping]
– rm -rf
Jan 13, 2013 at 15:21