Skip to content

Figure.text sometimes doesn't work if the text contains single/double quotation marks #3104

@xumi1993

Description

@xumi1993

Description of the problem

I want to write text of A' on a figure with text box filled by a colour of fill='230'. When I use position='CM' to specify the position of the text, the A' -G230 is shown in the figure. I think the attribute fill='230' have not been correctly parsed.
ff6b8c3c-060b-4295-977a-684e0051dcd6

Minimal Complete Verifiable Example

label = "A\'"
fig = pygmt.Figure()
fig.basemap(region=[0, 10, 0, 10], projection="X4c/4c", frame=True)
fig.text(
    text=label,
    position='CM',
    fill='230'    
)
fig.show()

Full error message

No response

System information

PyGMT information:
  version: v0.11.0
System information:
  python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:33)  [Clang 13.0.1 ]
  executable: /Users/xumijian/miniconda3_arm/bin/python
  machine: macOS-14.2.1-arm64-arm-64bit
Dependency information:
  numpy: 1.24.2
  pandas: 2.2.1
  xarray: 2023.5.0
  netCDF4: 1.6.0
  packaging: 24.0
  contextily: None
  geopandas: None
  ipython: None
  rioxarray: None
  ghostscript: 10.02.1
GMT library information:
  cores: 10
  grid layout: rows
  image layout: 
  library path: /Users/xumijian/miniconda3_arm/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/xumijian/miniconda3_arm/lib/gmt/plugins
  share dir: /Users/xumijian/miniconda3_arm/share/gmt
  version: 6.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions