Plotting points out of 90 degree range

Hi,

I would like to plot some points around the globe an everything works fine, when input coordinates are less than 90 degrees. Well, that’s not enough. Here is the example code:

fig = pygmt.Figure()
fig.basemap(region="d", projection="Q10i", frame="afg")
fig.coast(land="#666666", water="skyblue")
fig.plot(x=60, y=110, style="c0.3c", fill="red", pen="black")
fig.show()

This leads to

plot [WARNING]: Latitude (110) at line # 1 exceeds -|+ 90! - set to NaN

and the point is not plotted. I looked here but it didn’t make much wiser.

There is a bug I believe, a bug in PyGMT.

no_clip=True should do the work. However, it does not work on my system when data are specified as x=..., y=.... With data="text.txt" no_clip works, the code and debug output is below.

x=60; y=110; style="c0.3c"; fill="red"; pen="black";
# fig.plot displays a warning and does not plot the symbol no matter no_clip is indicated:
fig.plot(x=x, y=y, region=region, projection=projection, style=style, fill=fill, pen=pen, no_clip=True)
#fig.plot() using data from a text file works:
with open("temp.txt", "w") as f:
    f.write(f'{x} {y}\n')
fill="yellow"
fig.plot(data="temp.txt", region=region, projection=projection, style=style, fill=fill, pen=pen, no_clip=True)

debug output from fig.plot() is below. -N appears on the command line, but the warning is issued and the data isn’t plotted.

pygmt-session [DEBUG]: Use PS filename /home/mkononets/.gmt/sessions/gmt_session.2900041/gmt_1.ps-
pygmt-session [DEBUG]: gmtinit_get_current_panel: No current panel selected so not in subplot mode
pygmt-session [DEBUG]: Revised options: @GMTAPI@-S-I-D-V-T-N-000000 -Gred -JQ10i -N -Rd -Sc0.3c -Vd -Wblack
plot [DEBUG]: History: Process -JQ10i
plot [DEBUG]: History: Process -Rd
plot [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
plot [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
plot [INFORMATION]: Processing input table data
plot [DEBUG]: Operation will require 2 input columns [n_cols_start = 2]
plot [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere
plot [INFORMATION]: Spherical approximation used
plot [INFORMATION]: Central meridian not given, default to 0
plot [DEBUG]: Projected values in meters: -2.00151e+07 2.00151e+07 -1.00076e+07 1.00076e+07
plot [DEBUG]: Computed automatic parameters using dimension scaling: 1.00614
plot [INFORMATION]: Map scale is 1575.99 km per cm or 1:1.57599e+08.
plot [DEBUG]: Running in PS mode modern
plot [DEBUG]: Use PS filename /home/mkononets/.gmt/sessions/gmt_session.2900041/gmt_1.ps-
plot [DEBUG]: Append to hidden PS file /home/mkononets/.gmt/sessions/gmt_session.2900041/gmt_1.ps-
plot [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
plot [DEBUG]: Basemap order: Frame = below  Grid = below  Tick/Annot = below
plot [DEBUG]: gmtapi_init_import: Passed family = Data Table and geometry = Point
plot [DEBUG]: gmtapi_init_import: Added 1 new sources
plot [DEBUG]: GMT_Init_IO: Returned first Input object ID = 0
plot [DEBUG]: GMT_Begin_IO: Mode value 1 not considered (ignored)
plot [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Input
plot [DEBUG]: gmtapi_next_io_source: Selected object 0
plot [INFORMATION]: Reading Data Table from Input memory location via vector
plot [DEBUG]: GMT_Begin_IO: Input resource access is now enabled [record-by-record]
plot [WARNING]: Latitude (110) at line # 1 exceeds -|+ 90! - set to NaN
plot [DEBUG]: GMT_End_IO: Input resource access is now disabled
plot [DEBUG]: Current size of half-baked PS file /home/mkononets/.gmt/sessions/gmt_session.2900041/gmt_1.ps- = 25233.

UPD pygmt.show_versions():

PyGMT information:
  version: v0.13.0
System information:
  python: 3.11.10 | packaged by conda-forge | (main, Oct 16 2024, 01:27:36) [GCC 13.3.0]
  executable: /home/mkononets/mambaforge/envs/pygmt/bin/python3
  machine: Linux-5.15.0-53-generic-x86_64-with-glibc2.35
Dependency information:
  numpy: 1.25.2
  pandas: 2.0.3
  xarray: 2023.7.0
  netCDF4: 1.7.1
  packaging: 23.1
  contextily: 1.3.0
  geopandas: 0.13.2
  IPython: 8.14.0
  rioxarray: 0.14.1
  gdal: 3.9.2
  ghostscript: 10.02.1
GMT library information:
  version: 6.5.0
  padding: 2
  share dir: /home/mkononets/mambaforge/envs/pygmt/share/gmt
  plugin dir: /home/mkononets/mambaforge/envs/pygmt/lib/gmt/plugins
  library path: /home/mkononets/mambaforge/envs/pygmt/lib/libgmt.so
  cores: 4
  grid layout: rows
  image layout: 
  binary version: 6.5.0

I can reproduce the issue. It’s likely an upstream GMT bug. I’ve opened an issue at Can't plot data points out of the [-180, 180, -90, 90] range in geographic plots · Issue #8606 · GenericMappingTools/gmt · GitHub to better track it.