Skip to main content

function line_series

Constructs a line series chart. Args:
  • xs: Sequence of x values. If a singular array is provided, all y values are plotted against that x array. If an array of arrays is provided, each y value is plotted against the corresponding x array.
  • ys: Sequence of y values, where each iterable represents a separate line series.
  • keys: Sequence of keys for labeling each line series. If not provided, keys will be automatically generated as “line_1”, “line_2”, etc.
  • title: Title of the chart.
  • xname: Label for the x-axis.
  • split_table: Whether the table should be split into a separate section in the W&B UI. If True, the table will be displayed in a section named “Custom Chart Tables”. Default is False.
Returns:
  • CustomChart: A custom chart object that can be logged to W&B. To log the chart, pass it to wandb.log().
Examples: Logging a single x array where all y series are plotted against the same x values:
In this example, a single xs series (shared x-values) is used for all ys series. This results in each y-series being plotted against the same x-values (0-9). Logging multiple x arrays where each y series is plotted against its corresponding x array:
In this example, each y series is plotted against its own unique x series. This allows for more flexibility when the x values are not uniform across the data series. Customizing line labels using keys:
This example shows how to provide custom labels for the lines using the keys argument. The keys will appear in the legend as “Linear”, “Quadratic”, and “Cubic”.