Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

It is possible to restrict the plotting region by using RegionFunction. However, it is also necessary to construct a concave hull of the data, and use a higher MaxPlotPoints when making the contour plot. Using RunnyKine's code from herehere to construct the region,

dat = Flatten[
   Import["https://dl.dropboxusercontent.com/u/659996/odd-data.m"], 1];
reg = alphaShapes2D[DeleteDuplicates@dat[[All, ;; 2]], .33];
RegionPlot[reg]

enter image description here

We can now get the proper contour plot,

Show[
 ListContourPlot[dat, PlotLegends -> Automatic, PlotRange -> All, 
  RegionFunction -> Function[{x, y, z}, RegionMember[reg, {x, y}]], 
  MaxPlotPoints -> 100],
 ListPlot@dat[[All, ;; 2]]
 ]

enter image description here

It is possible to restrict the plotting region by using RegionFunction. However, it is also necessary to construct a concave hull of the data, and use a higher MaxPlotPoints when making the contour plot. Using RunnyKine's code from here to construct the region,

dat = Flatten[
   Import["https://dl.dropboxusercontent.com/u/659996/odd-data.m"], 1];
reg = alphaShapes2D[DeleteDuplicates@dat[[All, ;; 2]], .33];
RegionPlot[reg]

enter image description here

We can now get the proper contour plot,

Show[
 ListContourPlot[dat, PlotLegends -> Automatic, PlotRange -> All, 
  RegionFunction -> Function[{x, y, z}, RegionMember[reg, {x, y}]], 
  MaxPlotPoints -> 100],
 ListPlot@dat[[All, ;; 2]]
 ]

enter image description here

It is possible to restrict the plotting region by using RegionFunction. However, it is also necessary to construct a concave hull of the data, and use a higher MaxPlotPoints when making the contour plot. Using RunnyKine's code from here to construct the region,

dat = Flatten[
   Import["https://dl.dropboxusercontent.com/u/659996/odd-data.m"], 1];
reg = alphaShapes2D[DeleteDuplicates@dat[[All, ;; 2]], .33];
RegionPlot[reg]

enter image description here

We can now get the proper contour plot,

Show[
 ListContourPlot[dat, PlotLegends -> Automatic, PlotRange -> All, 
  RegionFunction -> Function[{x, y, z}, RegionMember[reg, {x, y}]], 
  MaxPlotPoints -> 100],
 ListPlot@dat[[All, ;; 2]]
 ]

enter image description here

Source Link
Jason B.
  • 70.2k
  • 3
  • 144
  • 298

It is possible to restrict the plotting region by using RegionFunction. However, it is also necessary to construct a concave hull of the data, and use a higher MaxPlotPoints when making the contour plot. Using RunnyKine's code from here to construct the region,

dat = Flatten[
   Import["https://dl.dropboxusercontent.com/u/659996/odd-data.m"], 1];
reg = alphaShapes2D[DeleteDuplicates@dat[[All, ;; 2]], .33];
RegionPlot[reg]

enter image description here

We can now get the proper contour plot,

Show[
 ListContourPlot[dat, PlotLegends -> Automatic, PlotRange -> All, 
  RegionFunction -> Function[{x, y, z}, RegionMember[reg, {x, y}]], 
  MaxPlotPoints -> 100],
 ListPlot@dat[[All, ;; 2]]
 ]

enter image description here