pygmt.params.LegendSpec

class pygmt.params.LegendSpec[source]

A legend specification for pygmt.Figure.legend.

add_header(text, font=None)[source]

Add a centered header (H) [Default font is FONT_TITLE].

add_symbol(symbol, size, fill=None, pen=None, label=None, dx1=None, dx2=None)[source]

Add a symbol, with an optional explanatory label.

dx1 is the offset of the symbol from the left margin of the column and dx2 the offset of the label; both are computed by GMT if not given.

add_line(pen=None, length=None, label=None, dx1=None, dx2=None)[source]

Add a line segment (S), with an optional explanatory label.

A line segment is a symbol record using GMT’s horizontal dash symbol, so length is the length of the segment and pen its attributes.

dx1 is the offset of the segment from the left margin of the column and dx2 the offset of the label; both are computed by GMT if not given.

to_stringio()[source]

Return the specification as a io.StringIO object.

Return type:

StringIO