Main Content

plot

Plot actor track data frame

Since R2025a

Description

plot(trackData,frameIndex) plots the track positions in the input actor track data object trackData at the specified data frame index frameIndex on a bird's-eye plot.

example

plot(trackData,frameIndex,Name=Value) specifies options using one or more name-value arguments. For example, MarkerFaceColor="red" plots the actor track positions using red markers.

figHandle = plot(___) returns a figure handle as a birdsEyePlot object using any combination of input arguments from previous syntaxes.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Load recorded actor track data into the workspace.

load("trackedActorData.mat")

Initialize an ActorTrackData object using the information from the loaded actor track data.

timestamps = trackedActorData.Timestamps;
trackID = trackedActorData.TrackID;
position = trackedActorData.Position;
trackData = scenariobuilder.ActorTrackData(timestamps,trackID,position);

Plot the first frame of the actor track data object. Note that the plot labels each track with the corresponding track ID.

plot(trackData,1)

Map the track IDs of the actor track data object to unique numbers.

[mappedTrackData,map] = mapTrackIDsToNumbers(trackData)
mappedTrackData = 
  ActorTrackData with properties:

                Name: ''

          NumSamples: 600
            Duration: 29.9510
          SampleRate: 20.0327
          SampleTime: 0.0500
          Timestamps: [600×1 double]

             TrackID: {600×1 cell}
            Category: []
            Position: {600×1 cell}
           Dimension: []
         Orientation: []
            Velocity: []
               Speed: []
                 Age: []

          Attributes: []

      UniqueTrackIDs: [18×1 double]
    UniqueCategories: []

map =

  dictionary (string ⟼ double) with 18 entries:

    "13" ⟼ 1
    "22" ⟼ 2
    "23" ⟼ 3
    "24" ⟼ 4
    "25" ⟼ 5
    "26" ⟼ 6
    "28" ⟼ 7
    "31" ⟼ 8
    "32" ⟼ 9
    "33" ⟼ 10
    "37" ⟼ 11
    "38" ⟼ 12
    "39" ⟼ 13
    "4"  ⟼ 14
    "40" ⟼ 15
    "42" ⟼ 16
    "44" ⟼ 17
    "45" ⟼ 18

Plot the first frame of the mapped actor track data object. Note that the plot now labels each track with the corresponding mapped numeral.

plot(mappedTrackData,1)

Input Arguments

collapse all

Actor track data, specified as an ActorTrackData object.

Actor track frame index, specified as a positive integer. This value must be less than or equal to the value of the NumSamples property of the input actor track data object trackData.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: plot(trackData,MarkerFaceColor="red") plots the actor track positions using red markers.

Parent figure, specified as a Figure object, Axes object, or birdsEyePlot object. If you do not specify Parent, the function plots the track data on a bird's-eye plot in a new figure.

X-axis range of the bird's-eye plot in the vehicle coordinate system, specified as a two-element vector of the form [Xmin Xmax].

The X-axis is vertical, and is positive in the forward direction of the ego vehicle. The origin is at the center of the rear axle of the ego vehicle.

Empty bird's-eye plot with Xmin and Xmax labeled on vertical X-axis

For more details on the coordinate system used in the bird's-eye plot, see Vehicle Coordinate System.

Y-axis range of the bird's-eye plot in the vehicle coordinate system, specified as a two-element vector of the form [Ymin Ymax].

The Y-axis is horizontal, and is positive to the left of the ego vehicle, as viewed when facing forward. The origin is at the center of the rear axle of the ego vehicle.

Empty bird's-eye plot with Ymin and Ymax labeled on horizontal Y-axis

For more details on the coordinate system used in the birdsEyePlot object, see Vehicle Coordinate System.

Marker fill color, specified as "none", "auto", an RGB triplet, a hexadecimal color code, a color name, or a short color name. The "auto" option uses the same color as the Color property of the parent axes. If you specify "auto" and the axes plot box is invisible, the marker fill color is the color of the figure. For more information, see MarkerFaceColor in the MATLAB® plot function. The "none" option renders the markers without a fill color.

Number of previous actor tracks to display, specified as a nonnegative integer.

Output Arguments

collapse all

Figure handle, returned as a birdsEyePlot object.

Version History

Introduced in R2025a