# Drawing points in a map with GMT

**URL:** <https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744>\
**Category:** Visualization\
**Tags:** gmt\
**Created:** [April 5, 2025, 2:29pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744 "2025-04-05T14:29:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [April 5, 2025, 2:29pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/1 "2025-04-05T14:29:26Z")

</div>

Dear all,  
I have the code below where I plot south america with `GMT`:

```julia
using GMT
# Desenhe o mapa
coast(region=(-90, -30, -60, 15), proj=:Mercator, xaxis=(annot=10,ticks=5), yaxis=(annot=10,ticks=5), area=:10, land=:brown, scale=0.05, title="Capitais da América do Sul", show=true)

```

works well. I would like to insert, for example, the capitals in this map: for example:

```julia
# Defina as coordenadas das capitais da América do Sul
capitais = [
    ("Bogotá", -74.08, 4.61), # Colômbia
    ("Quito", -78.50, -0.22), # Equador
    ("Lima", -77.03, -12.05), # Peru
    ("Santiago", -70.67, -33.45), # Chile
    ("Buenos Aires", -58.38, -34.60), # Argentina
    ("Montevideo", -56.17, -34.85), # Uruguai
    ("Brasília", -47.93, -15.78), # Brasil
    ("Caracas", -66.90, 10.48), # Venezuela
    ("Georgetown", -58.15, 6.80), # Guiana
    ("Paramaribo", -55.17, 5.83), # Suriname
    ("Cayenne", -52.33, 4.93) # Guiana Francesa
]

```

When I trun the code below I have an error:

```julia
# Adicione as capitais ao mapa
for capital in capitais
    nome, lon, lat = capital
    plot!(lon, lat, marker=:circle, markersize=0.5, markerfacecolor=:red, markeredgecolor=:black)
    annotate!(lon, lat, text=nome, textcolor=:black, fontsize=10)
end

```

How can I insert a given set of points in this map?

---

<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:** [April 5, 2025, 3:44pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/2 "2025-04-05T15:44:48Z")

</div>

You cannot use `show=true` in first plot command because it will end the figure. `show` is only used in lat command when we finished. Also, `annotate!` function does not exist (yet) in GMT. Checking the [text](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/text/) man page helps.

One way of doing that

```julia
nomes = ["Bogotá", "Quito", "Lima", "Santiago", "Buenos Aires", "Montevideo", "Brasília", "Caracas", "Georgetown", "Paramaribo", "Cayenne"];
pts = [-74.08 4.61
		-78.50 -0.22
		-77.03 -12.05
		-70.67 -33.45
		-58.38 -34.60
		-56.17 -34.85
		-47.93 -15.78
		-66.90 10.48
		-58.15 6.80
		-55.17 5.83
		-52.33 4.93];

D = mat2ds(pts, nomes);

coast(region=(-90, -30, -60, 15), proj=:Mercator, xaxis=(annot=10,ticks=5), yaxis=(annot=10,ticks=5), area=:10, land=:brown, title="Capitais da América do Sul")

plot!(D, marker=:circle, markersize=0.5, markerfacecolor=:red, markeredgecolor=:black)
text!(D, show=true)

```

 ![GMTjl_j](https://global.discourse-cdn.com/julialang/original/3X/7/1/71becacf47deca044802db77bb5a0471d9d896a2.png)

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [April 5, 2025, 4:22pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/3 "2025-04-05T16:22:50Z")

</div>

> [@joa-quim](#):
>
> ```julia
> nomes = ["Bogotá", "Quito", "Lima", "Santiago", "Buenos Aires", "Montevideo", "Brasília", "Caracas", "Georgetown", "Paramaribo", "Cayenne"];
> pts = [-74.08 4.61
> -78.50 -0.22
> -77.03 -12.05
> -70.67 -33.45
> -58.38 -34.60
> -56.17 -34.85
> -47.93 -15.78
> -66.90 10.48
> -58.15 6.80
> -55.17 5.83
> -52.33 4.93];
> 
> D = mat2ds(pts, nomes);
> 
> coast(region=(-90, -30, -60, 15), proj=:Mercator, xaxis=(annot=10,ticks=5), yaxis=(annot=10,ticks=5), area=:10, land=:brown, title="Capitais da América do Sul")
> 
> plot!(D, marker=:circle, markersize=0.5, markerfacecolor=:red, markeredgecolor=:black)
> text!(D, show=true)
> 
> ```

Thank you so much! Wonderfulll.  
One more question: if I want to connect the cities of Santiago to Brasil, Santiago to Bogotá, etc… (with an arrow), how can I do this?

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [April 5, 2025, 4:52pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/4 "2025-04-05T16:52:39Z")

</div>

… and reduce the font size of the capitals. Thank you so much!

---

<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:** [April 5, 2025, 4:52pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/5 "2025-04-05T16:52:41Z")

</div>

There is the `connection` option of the `plot` function, but it is a bit daunting. At least without concrete examples. Maybe what’s in this example is simpler.

> **[Arrow examples](https://www.generic-mapping-tools.org/GMTjl_doc/examples/arrows/10_arrows/#cartesian_circular_and_geographic_vectors)**

---

<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:** [April 5, 2025, 4:53pm UTC](https://discourse.julialang.org/t/drawing-points-in-a-map-with-gmt/127744/6 "2025-04-05T16:53:38Z")

</div>

> [@angeloaliano1](#):
>
> and reduce the font size of the capitals.

See the `text` manual I pointed above.
