ROCCurve Properties
ROCCurve properties control the appearance and behavior of a
ROCCurve object, which the plot function of a
rocmetrics object returns
for each receiver operating characteristic (ROC) curve or other performance
curve.
By changing property values, you can modify certain aspects of the ROC curve. Use dot notation to query and set properties; for example:
rocObj = rocmetrics(Labels,Scores,ClassNames); curveObj = plot(rocObj); c = curveObj(1).Color; curveObj(1).Color = "red";
ROC Curve Data
This property is read-only.
Performance metric for the x-axis, stored in XData, specified as
a string scalar of the performance metric name.
The XAxisMetric
name-value argument of the plot function sets this property. The
default value of this argument is "FalsePositiveRate".
For details about built-in and custom metric names, see the XAxisMetric
name-value argument of the plot function.
This property is read-only.
x-axis values for XAxisMetric,
specified as a numeric vector.
Data Types: double
This property is read-only.
Performance metric for the y-axis, stored in YData, specified as
a string scalar of the performance metric name.
The YAxisMetric
name-value argument of the plot function sets this property. The
default value of this argument is "TruePositiveRate".
For details about built-in and custom metric names, see the XAxisMetric
name-value argument of the plot function.
This property is read-only.
y-axis values for YAxisMetric,
specified as a numeric vector.
Data Types: double
ROC Curve Options
Flag to show the confidence intervals for the y-axis metric (YAxisMetric),
specified as logical 1 (true) or
0 (false).
The ShowConfidenceIntervals name-value argument of the
plot function sets this property. The default value of the
argument is false.
The ShowConfidenceIntervals value can be true only if
the Metrics property of
the rocmetrics object
contains the confidence intervals for the y-axis metric.
Using confidence intervals requires Statistics and Machine Learning Toolbox™.
Color
Color of the line and confidence interval shading, specified as an RGB triplet, hexadecimal color code, color name, or short name.
RGB triplets and hexadecimal color codes are useful for specifying custom colors.
An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range
[0,1]; for example,[0.4 0.6 0.7].A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (
#) followed by three or six hexadecimal digits, which can range from0toF. The values are not case sensitive. Thus, the color codes"#FF8800","#ff8800","#F80", and"#f80"are equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
| Color Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
|---|---|---|---|---|
"red" | "r" | [1 0 0] | "#FF0000" |
|
"green" | "g" | [0 1 0] | "#00FF00" |
|
"blue" | "b" | [0 0 1] | "#0000FF" |
|
"cyan"
| "c" | [0 1 1] | "#00FFFF" |
|
"magenta" | "m" | [1 0 1] | "#FF00FF" |
|
"yellow" | "y" | [1 1 0] | "#FFFF00" |
|
"black" | "k" | [0 0 0] | "#000000" |
|
"white" | "w" | [1 1 1] | "#FFFFFF" |
|
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors |
|---|---|
Before R2025a: Most plots use these colors by default. |
|
|
|
You can get the RGB triplets and hexadecimal color codes for these palettes using the orderedcolors and rgb2hex functions. For example, get the RGB triplets for the "gem" palette and convert them to hexadecimal color codes.
RGB = orderedcolors("gem");
H = rgb2hex(RGB);Before R2023b: Get the RGB triplets using RGB =
get(groot,"FactoryAxesColorOrder").
Before R2024a: Get the hexadecimal color codes using H =
compose("#%02X%02X%02X",round(RGB*255)).
Example: 'blue'
Example: [0 0 1]
Example: '#0000FF'
Mode for setting the Color property, specified as one of these values:
'auto'— The software controls the value of theColorproperty by using theSeriesIndexproperty of theROCCurveobject and theColorOrderproperty of the axes.'manual'— You control the value of theColorproperty manually by setting the value of theColorproperty directly on the object.
If you change the value of the Color property manually, the software changes the value of the ColorMode property to 'manual'.
Line
Line style, specified as one of the options in this table.
| Line Style | Description | Resulting Line |
|---|---|---|
"-" | Solid line |
|
"--" | Dashed line |
|
":" | Dotted line |
|
"-." | Dash-dotted line |
|
"none" | No line | No line |
Mode for setting the LineStyle property, specified as one of these values:
'auto'— The software controls the value of theLineStyleproperty by using theSeriesIndexproperty of theROCCurveobject and theLineStyleOrderproperty of the axes.'manual'— You control the value of theLineStyleproperty manually by setting the value of theLineStyleproperty directly on the object.
If you change the value of the LineStyle property manually, the software changes the value of the LineStyleMode property to 'manual'.
Line width, specified as a positive value 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 is displayed one pixel wide.
Series index, specified as a positive whole number or "none". This property
is useful for reassigning the colors, line styles, or markers of several
ROCCurve objects so that they match each other. By default, the
SeriesIndex property of a ROCCurve object is a
number that corresponds to its order of creation, starting at
1.
The software uses the number to calculate indices for assigning color, line style, or markers
when you call plotting functions. The indices refer to the rows of the arrays stored in
the ColorOrder and LineStyleOrder properties
of the axes. The software automatically updates the color, line style, or markers of the
ROCCurve object when you change its
SeriesIndex, or when you change the
ColorOrder or LineStyleOrder properties of
the axes.
The following conditions must be true for the changes to have any effect:
At least one of these properties of the
ROCCurveobject is set to'auto':ColorMode,LineStyleMode, orMarkerMode.The
SeriesIndexproperty of theROCCurveobject is greater than0.The
NextSeriesIndexproperty of the axes object is greater than0.
Markers
Marker symbol, specified as one of the values in this table. By default, the object does not display markers. Specifying a marker symbol adds markers at each data point or vertex.
| Marker | Description | Resulting Marker |
|---|---|---|
"o" | Circle |
|
"+" | Plus sign |
|
"*" | Asterisk |
|
"." | Point |
|
"x" | Cross |
|
"_" | Horizontal line |
|
"|" | Vertical line |
|
"square" | Square |
|
"diamond" | Diamond |
|
"^" | Upward-pointing triangle |
|
"v" | Downward-pointing triangle |
|
">" | Right-pointing triangle |
|
"<" | Left-pointing triangle |
|
"pentagram" | Pentagram |
|
"hexagram" | Hexagram |
|
"none" | No markers | Not applicable |
Mode for setting the Marker property, specified as one of these values:
'auto'— The software controls the value of theMarkerproperty by using theSeriesIndexproperty of theROCCurveobject and theLineStyleOrderproperty of the axes.'manual'— You control the value of theMarkerproperty manually by setting the value of theMarkerproperty directly on the object.
If you change the value of the Marker property manually, the software changes the value of the MarkerMode property to 'manual'.
Legend
Text used in the legend, specified as a character vector.
The default value of DisplayName is the name of the class for which the curve describes the performance. If the curve is a ROC curve, then DisplayName also contains the area under the ROC curve (AUC) value.
Alternatively, you can specify the legend text using the legend function.
If you interactively edit the character vector in an existing legend, then the software updates the DisplayName property to the edited character vector.
Control for including the ROCCurve object in the legend or excluding the object from the legend, specified as an Annotation object. Set the underlying IconDisplayStyle property to one of these values:
'on'— Include theROCCurveobject in the legend (default).'off'— Do not include theROCCurveobject in the legend.
For example, to exclude the ROCCurve object curveObj from the legend, set the IconDisplayStyle property to 'off'.
curveObj.Annotation.LegendInformation.IconDisplayStyle = 'off';
Alternatively, you can control the items in a legend using the legend function. Specify the first input argument as a vector of the graphics objects to include. If you do not specify an existing graphics object in the first input argument, then it does not appear in the legend. However, graphics objects added to the axes after the legend is created do appear in the legend. Consider creating the legend after creating all the plots to avoid extra items.
Interactivity
State of visibility for an object, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.
'on'— Display the object.'off'— Hide the object without deleting it. You still can access the properties of an invisible object.
Data tip content, specified as a DataTipTemplate object. You can control the content that appears in a data tip by modifying the properties of the underlying DataTipTemplate object. For a list of properties, see DataTipTemplate Properties.
For an example of modifying data tips, see Create Custom Data Tips.
Note
The DataTipTemplate object is not returned by findobj or findall, and it is not copied by copyobj.
Selection state of an object, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.
'on'— The object is selected. If you click the object when editing the plot, the software sets the object'sSelectedproperty to'on'. If theSelectionHighlightproperty is also set to'on', the software displays selection handles around the object.'off'— The object is not selected.
Display of selection handles when an object is selected, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.
'on'— Display selection handles around the object when theSelectedproperty is set to'on'.'off'— Do not display selection handles around the object, even when theSelectedproperty is set to'on'.
Callback Execution Control
Ability to capture mouse clicks, specified as one of these values:
'visible'— Capture mouse clicks when they are visible. TheVisibleproperty must be set to'on'and you must click a part of theROCCurveobject that has a defined color. You cannot click a part that has an associated color property set to'none'. If the plot contains markers, then the entire marker is clickable if either the edge or the fill has a defined color. TheHitTestproperty determines if theROCCurveobject responds to the click or if an ancestor does.'all'— Capture mouse clicks regardless of visibility. TheVisibleproperty can be set to'on'or'off'and you can click a part of theROCCurveobject that has no color. TheHitTestproperty determines if theROCCurveobject responds to the click or if an ancestor does.'none'— Mouse clicks cannot be captured. Clicking theROCCurveobject passes the click to the object below it in the current view of the figure window. TheHitTestproperty has no effect.
Response to captured mouse clicks, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.
'on'— Create a data tip at a data point of theROCCurveobject.'off'— Trigger the callbacks for the nearest ancestor of theROCCurveobject that has one of these:HitTestproperty set to'on'PickablePartsproperty set to a value that enables the ancestor to capture mouse clicks
Note
The PickableParts property determines if the ROCCurve object can capture mouse clicks. If it cannot, then the HitTest property has no effect.
Parent/Child
Parent, specified as an Axes object.
Children, specified as an empty GraphicsPlaceholder array or a DataTip object array. Use this property to view a list of data tips plotted on the performance curve.
You cannot add or remove children using the Children property. To add a child to this list, set the Parent property of the DataTip object to the ROCCurve object.
Visibility of the object handle in the Children property of the parent, specified as one of these values:
'on'— The object handle is always visible.'off'— The object handle is invisible at all times. This option is useful for preventing unintended changes by another function. SetHandleVisibilityto'off'to temporarily hide the handle during the execution of that function.'callback'— The object handle is visible from callbacks or functions invoked by callbacks, but not from functions invoked from the command line. This option blocks access to the object at the command line, but permits callback functions to access the object.
If the object is not listed in the Children property of the parent, then functions that obtain object handles by searching the object hierarchy or querying handle properties cannot return the object. Examples of such functions include the get, findobj, gca, gcf, gco, newplot, cla, clf, and close functions.
Hidden object handles are still valid. Set the root ShowHiddenHandles property to 'on' to list all object handles regardless of their HandleVisibility property setting.
Identifier
This property is read-only.
Type of graphics object, specified as 'roccurve'. Use this property to find all objects of a given type within a plotting hierarchy, for example, searching for the type using findobj.
Object identifier, specified as a character vector or string scalar. You can specify a unique Tag value to serve as an identifier for an object. When you need to access the object elsewhere in your code, you can use the findobj function to search for the object based on the Tag value.
User data, specified as any MATLAB® array. For example, you can specify a scalar, vector, matrix, cell array, character array, table, or structure. Use this property to store arbitrary data on an object.
If you are working in App Designer, create public or private properties in the app to share data instead of using the UserData property. For more information, see Share Data Within App Designer Apps.
Version History
Introduced in R2022b
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)