# How to get rid of some meshes in ListDensityPlot

I have some data that needs to be represented using the function ListDensityPlot, for example :

data = {{1, 1, 1}, {2, 3, 2}, {1, 4, 3}, {5, 1, 4}, {6, 4, 5}}
ListDensityPlot[data]


And this gives : However, if we show the meshes using this code :

data = {{1, 1, 1}, {2, 3, 2}, {1, 4, 3}, {5, 1, 4}, {6, 4, 5}}
ListDensityPlot[data, Mesh -> All]


It shows this : How can i specify ListDensityPlot to only Plot within the data point, and not plot the region delimited by the triangle {1,1},{2,3},{1,4} (the one on the left side} ?

Thanks in advance

• Why is that triangle different than the other triangles where data is given at all of the vertices? – mjw Apr 8 '19 at 16:10
• because listdensityplot gives me a a polygon with 4 edges when the result is 5 edges. Same goes for my actual data, i have an n sided polygon when i actually want something like n+10 – mtmtciscoolwhenyoucanuseit Apr 8 '19 at 19:30

## 1 Answer

Use the option RegionFunction

data = {{1, 1, 1}, {2, 3, 2}, {1, 4, 3}, {5, 1, 4}, {6, 4, 5}};

ListDensityPlot[data, Mesh -> All,
RegionFunction ->
(Not[{#1, #2} \[Element] Triangle[{{1, 1}, {2, 3}, {1, 4}}]] &)] • thank you very much ! it does exactly what i need it to do ! – mtmtciscoolwhenyoucanuseit Apr 8 '19 at 19:05