# How to create lat/lon labels like “45°N” and “75°W” in GeoMakie?

**URL:** <https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 29, 2025, 11:08pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320 "2025-06-29T23:08:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [June 29, 2025, 11:08pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/1 "2025-06-29T23:08:02Z")

</div>

Below is my code. No matter what I tried. I can only get the degree symbol “°” displayed, but not the N or W next to it. Does anyone know how to do it properly?

```julia
using CairoMakie
using GeoMakie

# Create figure and geographical axis with correct projection settings
Han = Figure();
ga = GeoAxis(Han[1, 1];
    source = "+proj=longlat +datum=WGS84", # Input CRS (WGS84 lat/lon)
    dest = "+proj=moll +lat_0=45 +lon_0=-100",
    xticks = -180:30:-30,
    yticks = 10:10:80,
    xtickformat = xs -> [@sprintf("%.0f°", abs(x), x < 0 ? "W" : "E") for x in xs],
    ytickformat = ys -> [@sprintf("%.0f°", abs(y), y < 0 ? "S" : "N") for y in ys]
); 

# Add coastlines: 
lines!(ga, GeoMakie.coastlines(); color = :black)

```

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [June 30, 2025, 2:27pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/2 "2025-06-30T14:27:56Z")

</div>

The above code errors for me because it provides two arguments to a format string accepting only one. You need the format to specify a second argument. In this case, you want a string argument `%s`:

```julia-repl
julia> using Printf

julia> x = -6.0; @sprintf("%.0f°", abs(x), x < 0 ? "W" : "E")
ERROR: ArgumentError: Number of format specifiers and number of provided args differ: 1 != 2

julia> x = -6.0; @sprintf("%.0f°%s", abs(x), x < 0 ? "W" : "E")
"6°W"

```

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [July 1, 2025, 2:03am UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/3 "2025-07-01T02:03:06Z")

</div>

> [@mikmoore](#):
>
> `@sprintf("%.0f°%s", abs(x), x < 0 ? "W" : "E")`

Many thanks! However, it still does not work for me. Here is my new parameters verbatim:

```julia
    xtickformat = xs -> [@sprintf("%.0f°%s", abs(x), x < 0 ? "W" : "E") for x in xs],
    ytickformat = ys -> [@sprintf("%.0f°%s", abs(y), y < 0 ? "S" : "N") for y in ys]

```

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [July 1, 2025, 2:54pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/4 "2025-07-01T14:54:41Z")

</div>

Be more specific. What does “not work for me” mean? It errors? It runs but the labels aren’t what you expect?

With a normal Makie `Axis` the above works for me. When I run your version or one of GeoMakie’s demos with `GeoAxis` the labels are unchanged. So I’m guessing that’s your issue.

It seems that GeoMakie is not respecting the `_tickformat` arguments. What’s strange is that [GeoMakie has code for making ticks like this already](https://github.com/MakieOrg/GeoMakie.jl/blob/master/src/utils.jl) but it doesn’t appear to be used anywhere and I’m not familiar enough with the package to understand how to make it be used. It appears that these were used in older versions, as seen in examples in older issues [like this one](https://github.com/MakieOrg/GeoMakie.jl/issues/126).

It seems that you could open an issue on GeoMakie.

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [July 1, 2025, 5:05pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/5 "2025-07-01T17:05:23Z")

</div>

Many thanks. Do you know how to open an issue with GeoMakie?

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [July 1, 2025, 5:12pm UTC](https://discourse.julialang.org/t/how-to-create-lat-lon-labels-like-45-n-and-75-w-in-geomakie/130320/6 "2025-07-01T17:12:34Z")

</div>

Go to [GeoMakie’s issue tracker on GitHib](https://github.com/MakieOrg/GeoMakie.jl/issues), check to see if there’s already an issue for this (I didn’t see one), log in, select [New issue]. Then state what version of `GeoMakie` and `Makie`/`CairoMakie` you’re using, describe what happens versus what you expect to happen, and provide runnable code that reproduces the issue (start a fresh REPL and make sure it runs with the result you say).
