gsplot.line#

line(target, x, y, *, series=None, label=None, c=None, marker='o', ms=7, mew=1.5, mec=None, mfc=None, alpha_mfc=0.2, ls='--', lw=1, alpha=1, config=None, props=None)#

Plot publication-ready lines on one or more explicit Axes.

Parameters:
  • target (Axes | _AxesBase | Sequence[Axes | _AxesBase] | Mapping[Any, Axes | _AxesBase] | ndarray[tuple[int, ...], dtype[Any]]) – One Axes or a deterministic same-Figure collection of Axes.

  • x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | Mapping[object, Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]) – One finite one-dimensional pair broadcast to every target, or two exact-key mappings containing one pair per target.

  • y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | Mapping[object, Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]) – One finite one-dimensional pair broadcast to every target, or two exact-key mappings containing one pair per target.

  • series (Any) – Optional deterministic publication identity from 0 through 9.

  • label (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • c (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • marker (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • ms (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • mew (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • mec (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • mfc (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • alpha_mfc (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • ls (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • lw (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • alpha (Any) – Concise line controls. Scalars broadcast; exact-key mappings provide per-target colors, markers, and line styles.

  • config (Config | None) – Optional immutable configuration for omitted values.

  • props (Mapping[str, object] | None) – Optional closed advanced property mapping. It cannot duplicate a separately supplied direct field.

Returns:

Native Matplotlib line results in normalized target order.

Return type:

list[matplotlib.lines.Line2D] or tuple of lists

Raises:

DataError – If targets, data, series, or style values fail atomic preflight.

Notes

The target Axes cycle supplies color when both series and c are omitted. Line and edge alpha are materialized in their RGBA colors; marker faces use alpha * alpha_mfc independently, matching the 0.3 rendering contract. Long Matplotlib spellings and the names in LINE_ADVANCED_OPTIONS remain accepted through 1.x.

Examples

>>> import gsplot as gs
>>> figure, ax = gs.subplots()
>>> artists = gs.line(ax, [0, 1], [1, 2], series=0, label="sample")
>>> artists[0].axes is ax
True
>>> figure.clear()