I have a simple question I have no answer to - how do I create an Epilog in (for example) a DensityPlot that consists of a Disk[] with a hole with the inner radius being r1 and the outer radius being r2? Imagine something like this:

Graphics[{{Gray, Disk[{0, 0}, 1]}, {White, Disk[{0, 0}, 0.5]}}]

However, this would hide the density plot in the "hole" (it would stay white). How to create such object as an epilog to a density plot, stream plot etc?

I had two ideas: first, if there is something like GraphicsDifference, that would be it: bigger Disk minus the smaller one creates the object I'm after. However, I found no such function.

Second: create a circle using a really thick line so that the inner boundary corresponds to r1 and the outer to r2. However this would not scale nicely (i.e. using ImageSize -> ... during export would not preserve these radii).


  • 4
    $\begingroup$ Annulus was introduced in 10.2 $\endgroup$ – Kuba May 9 '18 at 20:32
  • $\begingroup$ Thanks, that's great! Exactly what I was looking for! I googled a lot of queries like "Disk with a hole", but nothing returned Annulus...I am sorry though. Just curious: how would you make a graphics with rectangular hole so that the hole is transparent (the plot is visible through it)? So as to keep to the spirit of the original question... $\endgroup$ – user16320 May 9 '18 at 20:36
  • $\begingroup$ A disk with a rectangular hole or a rectangle? $\endgroup$ – Kuba May 9 '18 at 20:46

use region tools to construct more general figures (addressing comment):

r = RegionDifference[ Disk[{8, 8}, 2], Rectangle[{7, 7}, {9, 8}]];
 ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}], 
 RegionPlot[r, Frame -> False, PlotStyle -> Red, 
  BoundaryStyle -> Black]]


ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
 Epilog -> 
  First@RegionPlot[r, Frame -> False, PlotStyle -> Red, 
    BoundaryStyle -> Black]]

enter image description here

  • $\begingroup$ This is what I've been looking for! Thank you. $\endgroup$ – user16320 May 9 '18 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.