Skip to content

fig.text() doesn't work if "text" is integer or float #706

Closed

Description

@seisman

Description of the problem

Full code that generated the error

import pygmt
fig = pygmt.Figure()
fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=True)
fig.text(x=5, y=5, text=5)
fig.show()

Full error message

text [ERROR]: Text record line 0 is NULL! Skipped but this is trouble)

It works before, but fails in recent releases.

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.2.2.dev9+g0cb8b609
System information:
  python: 3.8.3 (default, Jul  2 2020, 11:26:31)  [Clang 10.0.0 ]
  executable: /Users/seisman/.anaconda/bin/python
  machine: macOS-10.15.7-x86_64-i386-64bit
Dependency information:
  numpy: 1.19.2
  pandas: 1.1.4
  xarray: 0.16.1
  netCDF4: 1.5.4
  packaging: 20.4
  ghostscript: 9.53.3
  gmt: 6.2.0_d266c30_2020.11.25
GMT library information:
  binary dir: /Users/seisman/.anaconda/bin
  cores: 8
  grid layout: rows
  library path: /Users/seisman/local/GMT/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/seisman/local/GMT/lib/gmt/plugins
  share dir: /Users/seisman/local/GMT/share
  version: 6.2.0

Activity

  1. added
    bug
    on Nov 27, 2020
  2. seisman commented on Nov 28, 2020

    @seisman
    MemberAuthor

    In this case, text is a numeric vector, so it's passed to GMT by the put_vector function.

    pygmt/pygmt/clib/session.py

    Lines 1179 to 1181 in 5c8b851

    # Use put_vector for columns with numerical type data
    for col, array in enumerate(arrays[:columns]):
    self.put_vector(dataset, column=col, vector=array)

  3. added a commit that references this issue on Dec 11, 2020
    2128dd4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions