# Set the plot boundary in ListContourPlot\[ \] ?

**URL:** <https://community.wolfram.com/t/set-the-plot-boundary-in-listcontourplot/18652>\
**Category:** Questions\
**Tags:** graphics-and-visualization, numerical-computation\
**Created:** [August 9, 2021, 10:11am UTC](https://community.wolfram.com/t/set-the-plot-boundary-in-listcontourplot/18652 "2021-08-09T10:11:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogeshdandekar](https://avatars.discourse-cdn.com/v4/letter/y/f1d935/32.png) [@yogeshdandekar](https://community.wolfram.com/u/yogeshdandekar)\
**Post date:** [August 9, 2021, 10:11am UTC](https://community.wolfram.com/t/set-the-plot-boundary-in-listcontourplot/18652/1 "2021-08-09T10:11:52Z")

</div>

I want to set the curved boundaries for the plot output, using the RegionFunction option in the ListContourPlot command. But I am not getting the intended result, as clearly seen from the Mathematrica notebook that I have attached. I have a data set for which I want to generate a ListContourPlot.

I checked that the RegionFunction option in the ContourPlot command works well, but the RegionPlot command does not correctly show the boundaries.

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/5ef9f74a-6f2a-4da0-b638-454313317ef1)

---

<div class="post-metadata">

**Author:** ![mfroeling](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mfroeling/32/23010_2.png) [@mfroeling](https://community.wolfram.com/u/mfroeling)\
**Post date:** [August 9, 2021, 1:27pm UTC](https://community.wolfram.com/t/set-the-plot-boundary-in-listcontourplot/18652/2 "2021-08-09T13:27:00Z")

</div>

Not sure why its going wrong.

Somehow removing the only two points outside the region changes things

```
f = Function[{x, y, z}, 
   N[-2 (1 + Sqrt[1 - y]) + (3 + 2 Sqrt[1 - y]) y] < x < 
    N[-2 + 2 Sqrt[1 - y] + 3 y - 2 Sqrt[1 - y] y]];

datas = Select[data, f @@ # &];
Select[data, ! (f @@ #) &]

Grid@{ListContourPlot[#, 
     BoundaryStyle -> Directive[Red, Thick], 
     RegionFunction -> f] & /@ {data, datas}}

```

 ![2093im1.png](https://global.discourse-cdn.com/wolfram/original/3X/8/7/87b425f8c18005b4d55025e507c294cc91b1c075.png)

But adding the option `MaxPlotPoints` imposes a regular grid on your irregular data which seems to solve your issue

```
Grid@{
  {ListContourPlot[data, RegionFunction -> f, 
    BoundaryStyle -> Directive[Red, Thick]],
   ListContourPlot[data, RegionFunction -> f, 
    BoundaryStyle -> Directive[Red, Thick], MaxPlotPoints -> 40]
   },
  {ListContourPlot[data, RegionFunction -> f, Mesh -> All],
   ListContourPlot[data, RegionFunction -> f, Mesh -> All, 
    MaxPlotPoints -> 40]
   }}

```

 ![4788im2.png](https://global.discourse-cdn.com/wolfram/original/3X/8/e/8ed1f54c1b4b5944f1d034fb02c021106b1ea86d.png)
