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

  • $\begingroup$ 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. $\endgroup$
    – Bill
    Commented Aug 29, 2014 at 2:47
  • $\begingroup$ Related: (27252) $\endgroup$
    – Mr.Wizard
    Commented Apr 13, 2015 at 17:03

2 Answers 2


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

  • 3
    $\begingroup$ Neat trick for generating a random function. $\endgroup$
    – user484
    Commented 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}]

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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