# How can I obtain contour plots of a list of data over a polygon domain

I made a finite element code and I want to show the stress distribution over the domain. The domain is shown below and I know the value of the data at the middle of each quadrilateral element. I can use Graphics and assign a color to each quadrilateral depending on the intensity of the stress at each point but the visualization will not look very nice since the quadrilaterals are not small (I can make them smaller but the program will take longer time to compute the data). I want to use a function like ListContourPlot to obtain smooth contour plots for the stress distribution, something like the picture below with colors for each band: Is it possible to use ListContourPlot or ListDensityPlot and visualize the data variation over the domain shown in the figure below? From reading the manual for both these functions it's not possible to define such domain (Polygon). And if I use the functions without assigning the domain I obtain something like this, which is not exactly the domain: What can be done? Thank you.

• ListContourPlot takes the option RegionFunction Nov 28, 2017 at 21:53
• I tried to do so but I didn't obtain like this: RegionFunction -> Function[{x, y, z}, {x, y} [Element] Polygon[{{0, 0}, {96, 0}, {18, 102}, {15, 122}, {5, 122}, {5, 102}, {0, 0}}]] The result did not show the real domain,it showed the same one shown in color above. Nov 28, 2017 at 23:21

pts = {{0, 0}, {96, 0}, {18, 102}, {15, 122}, {5, 122}, {5, 102}, {0,
0}};

reg = DiscretizeGraphics[Polygon[pts]];

data = Table[Sin[(x + y)/80], {y, 0, 125}, {x, 0, 100}];

Show[
ListContourPlot[data,
RegionFunction -> Function[{x, y, z}, {x, y} ∈ reg]],
Graphics[{Red, AbsolutePointSize, Point[pts]}]] 