Main Content

ROCCurve Properties

Receiver operating characteristic (ROC) curve appearance and behavior

Since R2022a

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

expand all

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

This property is read-only.

Thresholds on classification scores at which the software finds each of the performance metric values (XData and YData), specified as a numeric vector.

Data Types: double

ROC Curve Options

expand all

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.

Color

expand all

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 from 0 to F. 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 NameShort NameRGB TripletHexadecimal Color CodeAppearance
"red""r"[1 0 0]"#FF0000"

Sample of the color red

"green""g"[0 1 0]"#00FF00"

Sample of the color green

"blue""b"[0 0 1]"#0000FF"

Sample of the color blue

"cyan" "c"[0 1 1]"#00FFFF"

Sample of the color cyan

"magenta""m"[1 0 1]"#FF00FF"

Sample of the color magenta

"yellow""y"[1 1 0]"#FFFF00"

Sample of the color yellow

"black""k"[0 0 0]"#000000"

Sample of the color black

"white""w"[1 1 1]"#FFFFFF"

Sample of the color white

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB® uses in many types of plots.

RGB TripletHexadecimal Color CodeAppearance
[0 0.4470 0.7410]"#0072BD"

Sample of RGB triplet [0 0.4470 0.7410], which appears as dark blue

[0.8500 0.3250 0.0980]"#D95319"

Sample of RGB triplet [0.8500 0.3250 0.0980], which appears as dark orange

[0.9290 0.6940 0.1250]"#EDB120"

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560]"#7E2F8E"

Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

[0.4660 0.6740 0.1880]"#77AC30"

Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

[0.3010 0.7450 0.9330]"#4DBEEE"

Sample of RGB triplet [0.3010 0.7450 0.9330], which appears as light blue

[0.6350 0.0780 0.1840]"#A2142F"

Sample of RGB triplet [0.6350 0.0780 0.1840], which appears as dark red

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 the Color property by using the SeriesIndex property of the ROCCurve object and the ColorOrder property of the axes.

  • 'manual' — You control the value of the Color property manually by setting the value of the Color property 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

expand all

Line style, specified as one of the options in this table.

Line StyleDescriptionResulting Line
"-"Solid line

Sample of solid line

"--"Dashed line

Sample of dashed line

":"Dotted line

Sample of dotted line

"-."Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

"none"No lineNo line

Mode for setting the LineStyle property, specified as one of these values:

  • 'auto' — The software controls the value of the LineStyle property by using the SeriesIndex property of theROCCurve object and the LineStyleOrder property of the axes.

  • 'manual' — You control the value of the LineStyle property manually by setting the value of the LineStyle property 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 ROCCurve object is set to 'auto': ColorMode, LineStyleMode, or MarkerMode.

  • The SeriesIndex property of the ROCCurve object is greater than 0.

  • The NextSeriesIndex property of the axes object is greater than 0.

Markers

expand all

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.

MarkerDescriptionResulting Marker
"o"Circle

Sample of circle marker

"+"Plus sign

Sample of plus sign marker

"*"Asterisk

Sample of asterisk marker

"."Point

Sample of point marker

"x"Cross

Sample of cross marker

"_"Horizontal line

Sample of horizontal line marker

"|"Vertical line

Sample of vertical line marker

"square"Square

Sample of square marker

"diamond"Diamond

Sample of diamond marker

"^"Upward-pointing triangle

Sample of upward-pointing triangle marker

"v"Downward-pointing triangle

Sample of downward-pointing triangle marker

">"Right-pointing triangle

Sample of right-pointing triangle marker

"<"Left-pointing triangle

Sample of left-pointing triangle marker

"pentagram"Pentagram

Sample of pentagram marker

"hexagram"Hexagram

Sample of hexagram marker

"none"No markersNot applicable

Mode for setting the Marker property, specified as one of these values:

  • 'auto' — The software controls the value of the Marker property by using the SeriesIndex property of the ROCCurve object and the LineStyleOrder property of the axes.

  • 'manual' — You control the value of the Marker property manually by setting the value of the Marker property 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

expand all

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 specify the text as an input argument to the legend function, then the legend uses the specified text and sets the DisplayName property to the same value.

  • If you do not specify the text as an input argument to the legend function, then the legend uses the text in the DisplayName property.

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 the ROCCurve object in the legend (default).

  • 'off' — Do not include the ROCCurve object 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

expand all

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's Selected property to 'on'. If the SelectionHighlight property 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 the Selected property is set to 'on'.

  • 'off' — Do not display selection handles around the object, even when the Selected property is set to 'on'.

Callback Execution Control

expand all

Ability to capture mouse clicks, specified as one of these values:

  • 'visible' — Capture mouse clicks when they are visible. The Visible property must be set to 'on' and you must click a part of the ROCCurve object 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. The HitTest property determines if the ROCCurve object responds to the click or if an ancestor does.

  • 'all' — Capture mouse clicks regardless of visibility. The Visible property can be set to 'on' or 'off' and you can click a part of the ROCCurve object that has no color. The HitTest property determines if the ROCCurve object responds to the click or if an ancestor does.

  • 'none' — Mouse clicks cannot be captured. Clicking the ROCCurve object passes the click to the object below it in the current view of the figure window. The HitTest property 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 the ROCCurve object.

  • 'off' — Trigger the callbacks for the nearest ancestor of the ROCCurve object that has one of these:

    • HitTest property set to 'on'

    • PickableParts property 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

expand all

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. Set HandleVisibility to '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

expand all

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 R2022a

expand all