Skip to content

Figure.paragraph: Font color is ignored in case "fill" or/and "pen" are used #4590

Closed

Description

@yvonnefroehlich

Description of the problem

Upstream bug report at GenericMappingTools/gmt#8989

Figure.paragraph allows to add text as paragraphs to a plot. When adding a box around the paragraph(s) via the pen or/and fill parameters, it seems like the font color is ignored (see part I).

paragraph with no box paragraph with fill paragraph with pen
Image Image Image

For Figure.text, this issue does not occur (see part II).

text with fill and pen
Image

I also tried -M directly with Figure.text and and the font color is also ignored when adding a box via the fill or/and pen parameters (see part III).

-M with no box -M with fill -M with pen
Image Image Image

Wondering if this could be an upsteam bug.

Minimal Complete Verifiable Example

part I

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[-5, 5, -5, 5], projection="X10c/10c", frame=True)

fig.paragraph(
    x=0,
    y=0,
    text=[
        "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " + \
        "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
        "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris " + \
        "nisi ut aliquip ex ea commodo consequat."
    ],
    parwidth="4.5c",
    linespacing="12p",
    font="10p,Helvetica-Bold,steelblue",
    angle=45,
    justify="MC",
    alignment="center",
    fill="lightgray",
    pen="1p,gray10",
)

fig.show()

part II

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[-5, 5, -5, 5], projection="X10c/10c", frame=True)

fig.text(
    x=0,
    y=0,
    text="My text",
    fill="gray",
    pen="1p,gray10",
    font="20p,Helvetica-Bold,steelblue",
)

fig.show()

part III

import pygmt

with open("text_para.txt", "w") as text_para:
    text_para.write('''\
> 0 0 12p 4.5c c
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
''')

fig = pygmt.Figure()
fig.basemap(projection="X10c/10c", region=[-5, 5, -5, 5], frame=True)
fig.text(
    textfiles="text_para.txt",
    font='10p,1,steelblue',
    angle=45,
    M=True,
    fill="gray",  # font color ignored
    pen="1p,gray10",  # font color ignored
)
fig.show()

Full error message

No error message occurs.

System information

pygmt.show_versions()
PyGMT information:
  version: v0.19.0.dev171
System information:
  python: 3.14.2 | packaged by conda-forge | (main, Dec  6 2025, 11:17:27) [MSC v.1944 64 bit (AMD64)]
  executable: C:\ProgramData\Anaconda3\envs\pygmt_env_dev\python.exe
  machine: Windows-10-10.0.19045-SP0
Dependency information:
  numpy: 2.4.1
  pandas: 2.3.3
  xarray: 2025.12.0
  packaging: 25.0
  contextily: 1.7.0
  geopandas: 1.1.2
  IPython: 9.9.0
  pyarrow: 22.0.0
  rioxarray: 0.20.0
  gdal: 3.12.1
  ghostscript: 10.06.0
GMT library information:
  version: 6.6.0
  padding: 2
  share dir: C:/Program Files (x86)/gmt6/share
  plugin dir: C:/ProgramData/Anaconda3/envs/pygmt_env_dev/Library/bin/gmt_plugins
  library path: C:/ProgramData/Anaconda3/envs/pygmt_env_dev/Library/bin/gmt.dll
  cores: 4
  grid layout: rows
  image layout: 
  binary version: 6.6.0

Activity

  1. added
    bug
    on Apr 15, 2026
  2. added
    upstream
    on Apr 16, 2026
  3. yvonnefroehlich commented on Apr 22, 2026

    @yvonnefroehlich
    MemberAuthor

    The upstream PR for fixing it was merged, so this issue could be close.

  4. added this to the 0.19.0 milestone on Apr 22, 2026
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

    bugupstream

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions