Help with Creating Oblique Mercator

Hello! I have been trying to create an oblique mercator with no success. Using the example from the “GMT” docs, could anyone verify I am translating this correctly? Thanks in advance!

Screen Shot 2021-04-28 at 10.20.25 PM

The screenshot of the code is difficult to read. Could you please cut and paste the PyGMT code to share? You can format it as code using three back-ticks before and after the block of code. For example:

```
code
```
produces

code

Of course; sorry about that!

fig = pygmt.Figure()
fig.coast(projection="Oc280/25.5/22/69/12c",
    region= [270, 305, 20, 25],
    frame="afg",
    land="gray",
    water="lightblue",
    )
fig.show()

The goal was to get an oblique view of the Caribbean, but am having little success.

Hi @eemcmullan, could you also report the output or error you are getting? I can run your example fine, this is the figure I am getting with your code above:

Maybe try posting the output of pygmt.show_versions(), in case there is something amiss with your installation, so that we can help debug.

I apologize, I don’t think my question was very good! I did get that output for my code. However, I am more-so wondering how this map from the GMT docs can be achieved with PyGMT, as using that region and projection doesn’t seem to work for me. Sorry again!

Good question! Here is an example for that plot:

import pygmt

fig = pygmt.Figure()
fig.coast(projection="Oc280/25.5/22/69/12c",
    region="270/20/305/25+r",
    frame="afg",
    land="gray",
    water="lightblue",
    )
fig.show()

Specifically, you need to use a string for the region parameter so that you can append +r to denote that the coordinates are for the bottom-left and top-right corners.

We can improve the API docs about the region parameter; right now the best resource for an explanation about this is the ‘setting the region’ tutorial: https://www.pygmt.org/dev/tutorials/regions.html.

This is one of the cases where the wrappers could detect the situation and do the appropriate -R…+r call under the hood.
(took a mental note to implement this in Julia)

I gotcha, thanks so much for the help!

Currently working on a PR with gallery examples for the oblique Mercator projections; I’m only able to pass regions using a string with +r and have the figure turn out as expected, and haven’t had any luck using a Python list. Is using a list possible or should the guidance for oblique Mercator figures be to use a string?