# GMT.jl : Coloring lakes, keeping oceans bathymetry

**URL:** https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163
**Category:** Geo
**Tags:** gmt
**Created:** [January 20, 2026, 4:14pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163 "2026-01-20T16:14:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)
#### Post date: [January 20, 2026, 4:14pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/1 "2026-01-20T16:14:06Z")

</div>

Hello! I’m trying to plot some points over a map. I would like to keep the default topography/bathymetry visuals, but the lakes are “green”, being over 0m at sea level (my guess). Here’s my current code. I tried to use the `coast` function, but it overrides the ocean visuals.

```julia
using GMT

grdimage("@earth_relief_01m", proj=(name=:lambertConic, center=[-97.5 48], parallels=[40 50]), region=(-140,-55,32,64), coast=true, show=false)
GMT.coast!(water="skyblue", shore=true)

GMT.plot!(station, marker=:circ, ms=0.23, mc=:white, markeredgecolor=:red, fmt=:png, figname=joinpath(repfig, "stations_NA.png"))

```

This gives the following figure:

 ![stations_NA](https://global.discourse-cdn.com/julialang/original/3X/d/d/dd9b5195c1d8baac9f7a496ca6c0c455bdb23115.jpeg)

While, if I omit the `coast` function, it gives a nice ocean visuals:

```julia
grdimage("@earth_relief_01m", proj=(name=:lambertConic, center=[-97.5 48], parallels=[40 50]), region=(-140,-55,32,64), coast=true, show=false)

GMT.plot!(station, marker=:circ, ms=0.23, mc=:white, markeredgecolor=:red, fmt=:png, figname=joinpath(repfig, "stations_NA.png"))

```

Which gives the following (lakes are green)

 ![stations_NA2](https://global.discourse-cdn.com/julialang/original/3X/a/6/a62a1b8ea694ec6999d898dfe69049b525e4f70f.jpeg)

I tried inverting the call of `coast` and `grdimage` without success.

Thanks!

---

<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: [January 20, 2026, 9:18pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/2 "2026-01-20T21:18:54Z")

</div>

The key here is to understand that coastlines in GMT are a set of polygons with different hierarchical levels (see brief [here](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/coast.html#gshhg-information)) and option `area`. Together, we can split it in to calls. The first plots only the coastlines and the second plots only the lakes and hence we paint/pen style them differently. See

```julia-auto
grdimage("@earth_relief_01m", proj=(name=:lambertConic, center=[-97.5 48], parallels=[40 50]), region=(-140,-55,32,64))

# Plot only the ocean-land interface (polygon level 1)
coast!(shore=true, area=(0,1,1))

# Plot only the coast-lakes interface (lakes are polygons level 2)
# The the 200 means that polygons with area < 200 km2 are nor drawn) 
coast!(shore=true, water=:red, area=(200,2,2), show=true)

```

 ![GMTjl_j](https://global.discourse-cdn.com/julialang/original/3X/a/2/a227d8db42a5040ec01dc4cd74373b30048f36cd.jpeg)

---

<div class="post-metadata">

### Author: ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)
#### Post date: [January 21, 2026, 6:05pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/3 "2026-01-21T18:05:33Z")

</div>

> [@joa-quim](#):
>
> ```julia-auto
> grdimage("@earth_relief_01m", proj=(name=:lambertConic, center=[-97.5 48], parallels=[40 50]), region=(-140,-55,32,64))
> 
> # Plot only the ocean-land interface (polygon level 1)
> coast!(shore=true, area=(0,1,1))
> 
> # Plot only the coast-lakes interface (lakes are polygons level 2)
> # The the 200 means that polygons with area < 200 km2 are nor drawn) 
> coast!(shore=true, water=:red, area=(200,2,2), show=true)
> 
> ```

Thanks! I works very well:

```julia
grdimage("@earth_relief_01m", proj=(name=:lambertConic, center=[-97.5 48], parallels=[40 50]), region=(-140,-55,32,64))
coast!(shore=true, area=(0,1,1))
coast!(shore=true, water="skyblue", area=(200,2,2), show=false)

GMT.plot!(station, marker=:circ, ms=0.23, mc=:white, markeredgecolor=:red, fmt=:png, figname=joinpath(repfig, "stations_NA3.png"))

```

 ![stations_NA3](https://global.discourse-cdn.com/julialang/original/3X/0/8/08bbedb97662207bea3194bec2b9f617fe9aac14.jpeg)

---

<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: [January 21, 2026, 8:20pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/4 "2026-01-21T20:20:16Z")

</div>

Just two quick notes.

One do not normally need to set `show=false` because that is the default for almost all functions (so that we can overlay like in current example). The exceptions are the `viz` function that is meant to be a quick visualizer ad hence has the `show=true` by default. Other exceptions are the demo functions like [seismicity](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/seismicity.html) and alike.

Adding `shade=true` to the `grdimage` command makes an even nicer image (IMO).

---

<div class="post-metadata">

### Author: ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)
#### Post date: [January 21, 2026, 8:22pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/5 "2026-01-21T20:22:23Z")

</div>

Thanks, I will try!

---

<div class="post-metadata">

### Author: ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)
#### Post date: [January 22, 2026, 1:10pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/6 "2026-01-22T13:10:42Z")

</div>

I agree that it is much better with the `shade=true` option!

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/d/3d553496227f885e23699ea1ea5125e82dd5f440.jpeg)

---

<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: [January 22, 2026, 2:06pm UTC](https://discourse.julialang.org/t/gmt-jl-coloring-lakes-keeping-oceans-bathymetry/135163/7 "2026-01-22T14:06:22Z")

</div>

Nice. And actually I over complicated this issue. There is an option in `coast` exactly for this (`river_fill`) but its long names parsing is broken, so one must use _condensed_ syntax. The two `coast!` calls above can be replaced by a simpler:

```julia-auto
coast!(shore=true, area=200, river_fill="skyblue+l")

```

and when a fix is committed, that can be expressed as:

```julia-auto
coast!(shore=true, area=200, river_fill=(lake=true, fill=:skyblue))

```
