Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Matlab's EEGlab toolbox has a topoplot function:


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

enter image description here

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...

share|improve this question
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 '14 at 2:47

2 Answers 2

up vote 14 down vote accepted

RegionFunction is the option you are looking for.

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]

enter image description here

share|improve this answer
Neat trick for generating a random function. –  Rahul Aug 29 '14 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}]

enter image description here

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

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.