# Trouble making topographical EEG interpolation

**URL:** <https://discourse.julialang.org/t/trouble-making-topographical-eeg-interpolation/35733>\
**Category:** Visualization\
**Tags:** interpolations, makie, gmt\
**Created:** [March 8, 2020, 10:39pm UTC](https://discourse.julialang.org/t/trouble-making-topographical-eeg-interpolation/35733 "2020-03-08T22:39:04Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 16, 2022, 12:22pm UTC](https://discourse.julialang.org/t/trouble-making-topographical-eeg-interpolation/35733/13 "2022-01-16T12:22:43Z")

</div>

> [@ElectronicTeaCup](#):
>
> I get the following: (Julia plot on the left, MATLAB on the right)
> 
> ![image](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a5fcedb9cc638334565789b56050a25a8f037a8.png)
> 
> Does anyone have any better approaches on getting the final product?

Using GMT and the tip from @joa-quim [here](https://discourse.julialang.org/t/contour-plot-for-non-rectangular-domain/57381/5), you can produce a contour plot like this (_OP’s script has random sampling, so input is different_):

 ![GMT_contours_in_a_circle](https://global.discourse-cdn.com/julialang/original/3X/d/f/df1340bc231269cbf91d72ac3ebb54f5eb5f08f4.png)

```julia
# GMT GRIDDING (Smith and Wessel [1990] Splines in tension):
using GMT
data = [electrode_locs_X electrode_locs_Y timepoint_trial_data]
x = y = LinRange(-0.65, 0.65, 100)
G = GMT.surface(data, R=(extrema(x)..., extrema(y)...), inc=(step(x), step(y)), T=0.1)

# GMT PLOTTING
circ0 = reduce(vcat, 0.65*[[cos(θ) sin(θ)] for θ in 0:0.1:2π]) # circle
GMT.contourf(G, clip=circ0, fmt=:png, show=true)

```

**NB:**  
_the spline interpolation method used acts along “flat” x-y support coordinates, but as mentioned it is also possible to use spherical surface splines acting along an ellipsoid_

---

_[View the full topic](https://discourse.julialang.org/t/trouble-making-topographical-eeg-interpolation/35733)._
