plot
Description
plot(
plots trajectories in the
input trajectory
)Trajectory
object trajectory
.
plot(
specifies options using one or more name-value arguments. For example,
trajectory
,Name=Value
)MarkerSize=5
plots the GPS waypoints with a marker size of 5.
returns a
figure handle as a figHandle
= plot(___)Line
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
Create Trajectory Using Timestamps and Waypoints
Load recorded GPS trajectory data into the workspace.
load("recordedGPSData.mat","X","Y","Z","timestamps")
Create a trajectory object by using the loaded timestamps and xyz-
coordinates.
traj1 = scenariobuilder.Trajectory(timestamps,X,Y,Z)
traj1 = Trajectory with properties: Name: '' NumSamples: 392 Duration: 19.5498 SampleRate: 20.0513 SampleTime: 0.0500 Timestamps: [392×1 double] Position: [392×3 double] Orientation: [392×3 double] Velocity: [392×3 double] Course: [392×1 double] GroundSpeed: [392×1 double] Acceleration: [392×3 double] AngularVelocity: [392×3 double] LocalOrigin: [0 0 0] TimeOrigin: 0 Attributes: []
Plot the trajectory object.
plot(traj1,ShowZ=true,ShowSpeed=true,ShowVelocity=true,LineWidth=0.1,MarkerSize=1)
Combine the xyz-coordinates into a waypoint matrix, and create another trajectory by using the timestamps and waypoints.
waypoints = [X Y Z]; traj2 = scenariobuilder.Trajectory(timestamps,waypoints)
traj2 = Trajectory with properties: Name: '' NumSamples: 392 Duration: 19.5498 SampleRate: 20.0513 SampleTime: 0.0500 Timestamps: [392×1 double] Position: [392×3 double] Orientation: [392×3 double] Velocity: [392×3 double] Course: [392×1 double] GroundSpeed: [392×1 double] Acceleration: [392×3 double] AngularVelocity: [392×3 double] LocalOrigin: [0 0 0] TimeOrigin: 0 Attributes: []
Plot the trajectory object.
plot(traj2,ShowHeading=true,ShowOrientation=true,LineWidth=0.1,MarkerSize=1)
Input Arguments
trajectory
— Trajectory with timestamps and waypoints
Trajectory
object
Trajectory with timestamps and waypoints, specified as a Trajectory
object.
Name-Value Arguments
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(trajectory,MarkerSize=5)
plots the trajectories with a
marker size of 5.
Parent
— Parent figure
Figure
object | Panel
object
Parent figure, specified as a Figure
object or
Panel
object. If you do not specify Parent
,
the function plots the trajectory in a new figure.
ShowZ
— Plot z-coordinates
false
or 0
(default) | true
or 1
Plot z-coordinates across timestamps, specified as a logical
1
(true
) or 0
(false
).
Data Types: logical
ShowSpeed
— Plot speed values
false
or 0
(default) | true
or 1
Plot speed values across timestamps, specified as a logical 1
(true
) or 0
(false
).
Data Types: logical
ShowHeading
— Plot heading angles
false
or 0
(default) | true
or 1
Plot heading angles across timestamps, specified as a logical 1
(true
) or 0
(false
).
Data Types: logical
ShowOrientations
— Plot orientation angles
false
or 0
(default) | true
or 1
Plot orientation angles across timestamps, specified as a logical
1
(true
) or 0
(false
).
Data Types: logical
ShowVelocities
— Plot velocity values
false
or 0
(default) | true
or 1
Plot velocity values across timestamps, specified as a logical
1
(true
) or 0
(false
).
Data Types: logical
ShowAcceleration
— Plot acceleration values
false
or 0
(default) | true
or 1
Plot acceleration values across timestamps, specified as a logical
1
(true
) or 0
(false
).
Data Types: logical
ShowAngularVelocity
— Plot angular velocity values
false
or 0
(default) | true
or 1
Plot angular velocity values across timestamps, specified as a logical
1
(true
) or 0
(false
).
Data Types: logical
LineSpec
— Line style, marker, and color
string scalar | character vector
Line style, marker, and color, specified as a string scalar or character vector
containing symbols. For more information, see LineSpec
in another
plot
function.
Data Types: string
| char
LineWidth
— Line width
1
(default) | positive scalar
Line width, specified as a positive scalar in points, where 1 point = 1/72 of an inch. If the line has markers, then the line width also affects the marker edges.
The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.
Data Types: double
MarkerSize
— Marker size
5
(default) | positive scalar
Marker size, specified as a positive scalar in points, where 1 point = 1/72 of an inch.
Data Types: double
MarkerFaceColor
— Marker fill color
"none"
(default) | "auto"
| RGB triplet | hexadecimal color code | "r"
| "g"
| "b"
| ...
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 another
plot
function. The "none"
option renders the
markers without a fill color.
HeadingStep
— Number of points to skip heading
round(trajectory.NumSamples*0.1)
(default) | positive integer
Number of points to skip between heading makers, specified as a positive integer.
This value must be between 0
and the value of
NumSamples
property of the input
trajectory
object.
Data Types: uint8
| uint16
| uint32
| uint64
OrientationUnit
— Orientation units
"radians"
(default) | "degrees"
Orientation units, specified as "radians"
or
"degrees"
.
Data Types: string
| char
Color
— Line color
[]
(default) | RGB triplet | hexadecimal color code | "r"
| "g"
| "b"
| ...
Line color, specified as an RGB triplet, a hexadecimal color code, a color name,
or a short color name. For more information, see Color
in another
plot
function.
Output Arguments
figHandle
— Figure handle
Figure
object
Figure handle, returned as a Figure
object. You can use the figure
handle to query and modify figure properties. For more information, see Figure Properties.
Version History
Introduced in R2024b
See Also
GPSData
| Trajectory
| CameraData
| LidarData
| recordedSensorData
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)