pygmt.Figure.paragraph
- Figure.paragraph(x, y, text, parwidth, linespacing, font=None, angle=None, justify=None, alignment='left')
Typeset one or multiple paragraphs.
This method typesets one or multiple paragraphs of text at a given position on the figure. The text is flowed within a given paragraph width and with a specified line spacing. The text can be aligned left, center, right, or justified.
Multiple paragraphs can be provided as a sequence of strings, where each string represents a separate paragraph, or as a single string with newline characters separating the paragraphs.
Full GMT docs at https://docs.generic-mapping-tools.org/6.6/text.html.
- Parameters:
x/y – The x, y coordinates of the paragraph.
text (
str|Sequence[str]) – The paragraph text to typeset. If a sequence of strings is provided, each string is treated as a separate paragraph.font (
float|str|None, default:None) – The font of the text.angle (
float|None, default:None) – The angle of the text.justify (
Optional[Literal['TL','TC','TR','ML','MC','MR','BL','BC','BR']], default:None) – Set the alignment of the block of text, relative to the given x, y position. Choose a 2-character justification code.alignment (
Literal['left','center','right','justified'], default:'left') – Set the alignment of the text. Valid values are"left","center","right", and"justified".
Examples
>>> import pygmt >>> >>> fig = pygmt.Figure() >>> fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=True) >>> fig.paragraph( ... x=4, ... y=4, ... text="This is a long paragraph. " * 10, ... parwidth="5c", ... linespacing="12p", ... font="12p", ... ) >>> fig.show()