7
$\begingroup$

Matlab's EEGlab toolbox has a topoplot function:

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

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

$\endgroup$
  • $\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 Aug 29 '14 at 2:47
  • $\begingroup$ Related: (27252) $\endgroup$ – Mr.Wizard Apr 13 '15 at 17:03
17
$\begingroup$

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

enter image description here

$\endgroup$
  • 3
    $\begingroup$ Neat trick for generating a random function. $\endgroup$ – Rahul Aug 29 '14 at 3:44
10
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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