How to insert circles or other graphic in plots of data

 How to insert circles or other graphic in plots of data

I have many sets of data which I plot with ListDensityPlot, recursively. Therefore, I defined a function to recall for every set. I defined the style for labels, legends and other features; I also set an Epilog for numbering of each figure. I need a polygon to delimit certain regions in each plot of data. I tried with many options suggested online, but I can’t actually get anything on my plots.
Here is the crucial part of my code, where I cropped part of the options in order to help focus:

plotFunc[c_, label_] :=
 ListDensityPlot[c,
  Frame -> True,
  PlotRange -> plotrange, (*this is previously defined*)
  AspectRatio -> 1,
  ImageSize -> imageSize, (*this is previously defined*)
  FrameTicks -> frameTicks, (*this is previously defined*)
  BaseStyle -> {Medium, FontFamily -> "Times", Bold, 30},
  ColorFunction -> color,
  PlotLegends -> 
   Placed[BarLegend[Automatic,
     LegendMarkerSize -> {25, 300}, 
     LegendMargins -> {{-5, 0}, {0, 0}}, 
     LabelStyle -> {24, Bold, FontFamily -> "Times"}], Right],
  FrameStyle -> Directive[Black, Thick],
  Epilog -> {Style[Inset[Text@label, Scaled@{.1, .9}, Background -> White], 40]}
 ]

At this point (BUT BEFORE the closing ]), I’d like to add a graphic element (with Epilog or something else) to define a circle, a square, whatever (in my case is a hexagon, but it can well be a set of segments).
I tried with something along the following lines:

Epilog -> {Directive[{Thick, Black, Dashed}], Line{{0,0},{1,1}}}

but that doesn’t draw anything.

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange