Skip to content

vlt.plot.timeline

  vlt.plot.timeline - Creates a highly customizable timeline plot.

    vlt.plot.timeline(COMMAND_ROWS, 'NAME1', VALUE1, ...)

    Generates a timeline based on an array of vlt.plot.timelineRow objects.

    See also: vlt.plot.timelineRow, vlt.plot.timelineFromJSON
    This function provides extensive control over the plot's appearance,
    including time boundaries, labels, colors, and fonts.

    Inputs:
    COMMAND_ROWS: An array of vlt.plot.timelineRow objects. Each object
        defines a graphical element to be plotted. See `help vlt.plot.timelineRow`
        for details on the properties of these objects.

    Optional Name-Value Pair Arguments:
    'rowHeight' (default: 1)
        - The vertical height of each row in data units.
    'Heading1FontSize' (default: 14)
        - Font size for 'Heading1' and 'RowLabel' types.
    'Heading2FontSize' (default: 12)
        - Font size for 'Heading2' type.
    'Heading3FontSize' (default: 10)
        - Font size for 'Heading3' type.
    'timePre' (default: auto)
        - The x-axis time at which to begin the plot and place left-aligned RowLabels.
          If NaN, it's automatically calculated from the data.
    'timeStart' (default: auto)
        - The time that marks the "start" of the main timeline events and
          the position of right-aligned RowLabels.
          If NaN, it's automatically calculated from the data.
    'timeEnd' (default: auto)
        - The time at which to end the x-axis. If NaN, it's auto-calculated.
    'timeStartVerticalBar' (default: true)
        - If true, draws a vertical bar at 'timeStart'.
    'timeStartVerticalBarLineWidth' (default: 1)
        - The line width of the 'timeStart' vertical bar.
    'timeStartVerticalBarColor' (default: [0 0 0])
        - The color of the 'timeStart' vertical bar.
    'timelineBackgroundColor' (default: [0.9 0.9 0.9])
        - The background color of the plot axes.
    'axes' (default: [])
        - A handle to an existing axes object to plot into. If empty, a new
          figure and axes are created.
    'XLabel' (default: '')
        - A string to label the x-axis.

    Example:
      % Define timeline events using vlt.plot.timelineRow
      cmds(1) = vlt.plot.timelineRow('Row',1,'Type','RowLabel','String','Phase 1');
      cmds(2) = vlt.plot.timelineRow('Row',1,'Type','Bar','T0',5,'T1',15,'Color',[0.5 0.5 1]);
      cmds(3) = vlt.plot.timelineRow('Row',2,'Type','RowLabel','String','Phase 2');
      cmds(4) = vlt.plot.timelineRow('Row',2,'Type','Bar','T0',15,'T1',25,'Color',[0.5 1 0.5]);
      cmds(5) = vlt.plot.timelineRow('Row',2,'Type','Marker','T0',20, ...
          'Symbol','d','String','Key Event','VerticalAlignment','above');

      % Create the plot
      figure;
      vlt.plot.timeline(cmds, 'timePre', 0, 'timeStart', 0, 'timeEnd', 30, ...
          'XLabel', 'Time (days)');