# Contour plot for non-rectangular domain

**URL:** <https://discourse.julialang.org/t/contour-plot-for-non-rectangular-domain/57381>\
**Category:** General Usage\
**Tags:** plotting, visualization, gmt\
**Created:** [March 17, 2021, 1:41pm UTC](https://discourse.julialang.org/t/contour-plot-for-non-rectangular-domain/57381 "2021-03-17T13:41:20Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [March 18, 2021, 3:34am UTC](https://discourse.julialang.org/t/contour-plot-for-non-rectangular-domain/57381/5 "2021-03-18T03:34:02Z")

</div>

It was already possible to do this with GMT but it was a bit cumbersome, now with master version one can

```julia
f(x,y) = cos(2 * pi * x) * sin(2 * pi * y);
x = linspace(0,1,100);
G = mat2grid(f, x, x); # because countourf cannot yet ingest functions

# Clip inside a triangle for simplicity but the shape could be anything and any number of shapes
contourf(G, clip=[0.1 0.1; 0.5 0.9; 0.9 0.1], fmt=:png, show=true)

```

 ![GMTjl_tmp](https://global.discourse-cdn.com/julialang/original/3X/4/9/49064afba57037a34904223bac42a1aa46f460bd.png)

---

_[View the full topic](https://discourse.julialang.org/t/contour-plot-for-non-rectangular-domain/57381)._
