({{, (RefLink[MeshFunctions, paclet:ref/MeshFunctions])
is an option for plotting functions that specifies functions to use to determine the placement of mesh divisions. }})

OpenersNotesSection(Spacer1)Details

In (RefLink[Plot3D, paclet:ref/Plot3D]), the default setting (RefLink[MeshFunctions, paclet:ref/MeshFunctions])->{#1&,#2&} specifies that meshes corresponding to x and y coordinates should be constructed.

With the setting (RefLink[MeshFunctions, paclet:ref/MeshFunctions])->{(Subscript[m, 1]),(Subscript[m, 2]),…}, each function (Subscript[m, i]) defines a family of mesh divisions.

By default, the mesh divisions are taken to lie at positions giving equally spaced values of (Subscript[m, i])[…].

The arguments supplied to the (Subscript[m, i]) and the default (RefLink[MeshFunctions, paclet:ref/MeshFunctions]) settings are as follows:

Each (Subscript[m, i]) effectively defines a foliation.

The (Subscript[m, i]) should normally be chosen to be continuous monotonic functions.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Put 5 mesh lines in the z direction:

Plot3D[Sin[x+y^2],{x,-3,3},{y,-2,2},MeshFunctions->{#3&},Mesh->5]

Show curves of constant real and imaginary parts of a function:

DensityPlot[Arg[Sqrt[x+I y]],{x,-3,3},{y,-3,3},Mesh->10,MeshFunctions->{Re[Sqrt[#1+I #2]]&,Im[Sqrt[#1+I #2]]&}]

Show intersection points:

Plot[{Sin[x],Cos[x]},{x,0,6 Pi},Mesh->{{0.}},MeshFunctions->{Sin[#]-Cos[#]&},MeshStyle->Directive[PointSize[0.03],Red]]

OpenersExampleSection2(Spacer1)Applications  (1)

Define two polynomials:

{f,g}={27 x+130,-12-58 x+(x^2)+(x^3)};

Use (RefLink[MeshFunctions, paclet:ref/MeshFunctions]) to find the x intercepts:

Plot[g,{x,-10,10},MeshFunctions->{g/.x->#&},Mesh->{{0}},MeshStyle->PointSize[Large]]

Use (RefLink[MeshFunctions, paclet:ref/MeshFunctions]) to find the intersections between two functions:

Plot[{f,g},{x,-10,10},MeshFunctions->{(f-g)/.x->#&},Mesh->{{0}},MeshStyle->PointSize[Large]]

OpenersExampleSection3(Spacer1)Neat Examples  (2)

A case where Fubini's theorem does not hold (WebLink[[more info]:, http://mathworld.wolfram.com/FubiniTheorem.html])

Plot3D[(x^2-y^2)/(x^2+y^2)^2,{x,-1.5,1.5},{y,-1.5,1.5},BoxRatios->Automatic,PlotPoints->25,MeshFunctions->{#3&},MeshStyle->Purple,MeshShading->{None,Green,None,Yellow}]

Real and imaginary parts as mesh functions:

$TrigFunctions={Sin,Cos,Sec,Csc,Tan,Cot,ArcSin,ArcCos,ArcSec,ArcCsc,ArcTan,ArcCot,Sinh,Cosh,Sech,Csch,Tanh,Coth,ArcSinh,ArcCosh,ArcSech,ArcCsch,ArcTanh,ArcCoth};

plots=Table[Plot3D[Abs[f[x+I y]],{x,-2,2},{y,-2,2},MeshFunctions->Function@@@{{{x,y,z},Re[f[x+I y]]},{{x,y,z},Im[f[x+I y]]}},MeshStyle->{Orange,Green},PlotLabel->f,Ticks->None],{f,$TrigFunctions}];

GraphicsGrid[Partition[plots,4],ImageSize->Large]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Contours, paclet:ref/Contours])  ▪  (RefLink[Mesh, paclet:ref/Mesh])  ▪  (RefLink[GridLines, paclet:ref/GridLines])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Vector Visualization, paclet:guide/VectorVisualization])}, {▪(RefLinkPlain[Plotting Options, paclet:guide/PlottingOptions])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/24-more-forms-of-visualization.html])(WebLink[: More Forms of Visualization, https://www.wolfram.com/language/elementary-introduction/24-more-forms-of-visualization.html])}})}})