# A topoplot function for Mathematica

Matlab's EEGlab toolbox has a topoplot function:

http://sccn.ucsd.edu/eeglab/

A typical topographical plot of an EEG signal is given below:

How can I reproduce this in Mathematica. I know that ContourPlot and ListCountourPlot provide such functionalities, however, the data is on a square grid... and I would like it on a circle like in the figure...

• Look at the documentation for ContourPlot, including clicking on Details and Options and also further down clicking on Options and then RegionFunction and reading all the fine print.
– Bill
Aug 29, 2014 at 2:47
• Related: (27252) Apr 13, 2015 at 17:03

RegionFunction is the option you are looking for.

ContourPlot[
Evaluate[Sum[Sin[RandomReal[5, 2].{x, y}], {5}]], {x, -3, 3}, {y, -3, 3},
BoundaryStyle -> {Thick, Black},
RegionFunction -> Function[{x, y, z}, x^2 + y^2 < 9]
]


• Neat trick for generating a random function.
– user484
Aug 29, 2014 at 3:44

An alternative to RegionFunction is ConditionalExpression. Using @paw's cool example

z = Sum[Sin[RandomReal[5, 2].{x, y}], {5}];
ContourPlot[Evaluate[ConditionalExpression[z,Norm[{x, y}, 2] < 3]], {x, -3, 3}, {y, -3, 3},
BoundaryStyle -> {Thick, Black}]


ContourPlot[Evaluate[ConditionalExpression[z, z Norm[{x, y}] < 3]], {x, -3, 3}, {y, -3, 3},
BoundaryStyle -> {Thick, Black}]