How to set north arrow position in pyGMT?

Hi, I am trying to set my north arrow position in pyGMT.I want it to be in the top left corner within the map frame, but It is currently in the lower left corner outside the map frame. I have been using

fig.basemap(region = [12, 20, 10, 11], rose="JML+w1.5c+f3+l")

My grid projection is ‘M20c’ and the region of my grid is [116,124,19,22].

This is how it looks

image

Hello @Anagabrielamantilla,

welcome to the GMT forum :slightly_smiling_face:!

You write your grid covers the region [116, 124, 19, 22], but in your code line you have region=[12, 20, 10, 11].

In your code line you have for the position rose="JML":

  • The upper-case J indicates outside of the map frame (or bounding box); for inside you need a lower-case j.
  • ML refers to “Middle Left”; for lower left or “Bottom Left” you need BL. In general, one has to give a two-letter (order independent) code, chosen from:
    vertical: T(op), M(iddle), or B(ottom) and horizontal: L(eft), C(entre), or R(ight).

So you want probably something like this:

import pygmt

fig = pygmt.Figure()

fig.basemap(
   region=[116, 124, 19, 22],
   projection="M20c",
   frame=True,
   rose="jBL+w1.5c+f3+l",
)

fig.show()

Output figure:

1 Like

thank you so much :slight_smile: my map looks nice