Control parallel coordinates plot appearance and behavior
ParallelCoordinatesPlot
properties control the appearance and
behavior of a ParallelCoordinatesPlot
object. By changing property values,
you can modify certain aspects of the plot display. For example, you can add a
title:
p = parallelplot(rand(10,4));
p.Title = 'My Title';
Title
— Plot title''
(default) | character vector | string array | cell array of character vectors | categorical arrayPlot title, specified as a character vector, string array, cell array of character vectors, or categorical array. By default, the plot has no title.
To create a multiline title, specify a string array or cell array of character vectors. Each element in the array corresponds to a line of text.
If you specify the title as a categorical array, MATLAB® uses the values in the array, not the categories.
Example: p = parallelplot(__,'Title','My Title Text')
Example: p.Title = 'My Title Text'
Example: p.Title = {'My','Title'}
CoordinateLabel
— Horizontal axis label''
(default) | character vector | string array | cell array of character vectors | categorical arrayHorizontal axis label for describing the set of coordinate variables, specified as a
character vector, string array, cell array of character vectors, or categorical array.
The CoordinateLabel
value appears below the
CoordinateTickLabels
value in the plot.
To create a multiline label, specify a string array or cell array of character vectors. Each element in the array corresponds to a line of text.
If you specify the label as a categorical array, MATLAB uses the values in the array, not the categories.
Example: p =
parallelplot(__,'CoordinateLabel','Measurements')
Example: p.CoordinateLabel = 'Measurements'
Example: p.CoordinateLabel = {'Measurements','(in
inches)'}
CoordinateTickLabels
— Coordinate variable labelsCoordinate variable labels, specified as a string array, cell array of character vectors, or categorical array. Each coordinate tick label appears directly below the ruler displaying the values for that coordinate variable.
If you specify the labels as a categorical array, MATLAB uses the values in the array, not the categories.
Example: p =
parallelplot(__,'CoordinateTickLabels',{'Height','Age','Smoker'})
Example: p.CoordinateTickLabels =
{'Height','Age','Smoker'}
DataLabel
— Vertical axis label''
(default) | character vector | string array | cell array of character vectors | categorical arrayVertical axis label for describing the rows of the data in
SourceTable
or Data
, specified as a
character vector, string array, cell array of character vectors, or categorical
array.
To create a multiline label, specify a string array or cell array of character vectors. Each element in the array corresponds to a line of text.
If you specify the label as a categorical array, MATLAB uses the values in the array, not the categories.
Example: p =
parallelplot(__,'DataLabel','Patients')
Example: p.DataLabel = 'Patients'
Example: p.DataLabel = {'Patients','(data set 1)'}
LegendTitle
— Legend titleLegend title, specified as a character vector, string array, cell array of character
vectors, or categorical array. Use ''
for no title.
To create a multiline title, specify a string array or cell array of character vectors. Each element in the array corresponds to a line of text.
If you specify the title as a categorical array, MATLAB uses the values in the array, not the categories.
Example: p = parallelplot(__,'LegendTitle','My Title
Text')
Example: p.LegendTitle = 'My Title Text'
Example: p.LegendTitle = {'My','Title'}
LegendVisible
— Visibility of legend'on'
| on/off logical valueVisibility of legend, 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
.
Set LegendVisible
to 'on'
to display the
legend or 'off'
to hide the legend.
If GroupData
is empty ([]
), then
parallelplot
does not display a legend. Otherwise,
parallelplot
displays a legend by default.
In the legend, parallelplot
displays the group names in order
of their first appearance in GroupData
.
Example: p = parallelplot(__,'LegendVisible','off')
Example: p.LegendVisible = 'off'
DataNormalization
— Normalization method for coordinates'range'
(default) | 'none'
| 'zscore'
| 'scale'
| 'center'
| 'norm'
Normalization method for coordinates with numeric values, specified as one of the following options.
Method | Description |
---|---|
'range' | Display raw data along coordinate rulers that have independent minimum and maximum limits |
'none' | Display raw data along coordinate rulers that have the same minimum and maximum limits |
'zscore' | Display z-scores (with a mean of 0 and a standard deviation of 1) along each coordinate ruler |
'scale' | Display values scaled by standard deviation along each coordinate ruler |
'center' | Display data centered to have a mean of 0 along each coordinate ruler |
'norm' | Display 2-norm values along each coordinate ruler |
For more information about these methods, see normalize
.
For a coordinate variable that is a logical vector, datetime array, duration array,
categorical array, string array, or cell array of character vectors,
parallelplot
evenly distributes the unique possible values
along the coordinate ruler, regardless of the normalization method.
Example: p = parallelplot(__,'DataNormalization','none')
Example: p.DataNormalization = 'zscore'
Jitter
— Data displacement distance0.1
(default) | numeric scalar in the interval [0,1]Data displacement distance along the coordinate rulers, specified as a numeric scalar in the
interval [0,1]. The Jitter
value determines the maximum distance to
displace plot lines from their true value along the coordinate rulers, where the
displacement is a uniform random amount. If you set the Jitter
property to 1
, then adjacent jitter regions just touch. Set the
Jitter
property to 0
to display the true
data values.
Some amount of jitter is particularly helpful for visualizing categorical data because the
jittering enables you to distinguish between plot lines more easily. However, the
Jitter
value affects all coordinate variables, including
numeric variables.
Example: p = parallelplot(__,'Jitter',0.5)
Example: p.Jitter = 0.2
Color
— Group colorGroup color, specified in one of these forms:
Character vector designating a color name, short name, or hexadecimal
color code. A hexadecimal color code starts with a hash symbol
(#
) and is 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.
String array or cell array of character vectors designating one or more color names, short names, or hexadecimal color codes.
Three-column matrix of RGB values in the range [0,1]. The three columns represent the R value, G value, and B value.
Choose among these predefined colors, their equivalent RGB triplets, and their 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' |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] | '#0072BD' | |
[0.8500 0.3250 0.0980] | '#D95319' | |
[0.9290 0.6940 0.1250] | '#EDB120' | |
[0.4940 0.1840 0.5560] | '#7E2F8E' | |
[0.4660 0.6740 0.1880] | '#77AC30' | |
[0.3010 0.7450 0.9330] | '#4DBEEE' | |
[0.6350 0.0780 0.1840] | '#A2142F' |
By default, parallelplot
assigns a maximum of seven unique group colors. When the total number of groups exceeds the number of specified colors, parallelplot
cycles through the specified colors.
Example: p = parallelplot(__,'Color',{'blue','black','green'})
Example: p.Color = [0 0 1; 0 0.5 0.5; 0.5 0.5 0.5]
Example: p.Color = {'#EDB120','#77AC30','#7E2F8E'}
LineStyle
— Group line styleGroup line style, specified in one of these forms:
Character vector designating one line style
String array or cell array of character vectors designating one or more line styles
Choose among these line style options.
Line Style | Description | Resulting Line |
---|---|---|
'-' | Solid line |
|
'--' | Dashed line |
|
':' | Dotted line |
|
'-.' | Dash-dotted line |
|
'none' | No line | No line |
By default, parallelplot
assigns a line style of
'-'
to each group of plot lines. When the total number of groups
exceeds the number of specified line styles, parallelplot
cycles
through the specified line styles.
Example: p = parallelplot(__,'LineStyle',':')
Example: p.LineStyle = {'-.','-','--'}
LineWidth
— Group line widthGroup line width, specified as a positive scalar or positive vector in points. By
default, parallelplot
assigns a line width of 1
to each group of plot lines.
When the total number of groups exceeds the number of specified line widths,
parallelplot
cycles through the specified line widths.
Example: p = parallelplot(__,'LineWidth',1.5)
Example: p.LineWidth = [0.5 1.5 0.5]
LineAlpha
— Group line transparencyGroup line transparency, specified as a numeric scalar or numeric vector with values
between 0 and 1. Values closer to 0 specify more transparent lines, and values closer to
1 specify more opaque lines. By default, parallelplot
assigns a
LineAlpha
value of 0.7
to each group of plot
lines.
Example: p = parallelplot(__,'LineAlpha',0.75)
Example: p.LineAlpha = [0.2 0.7 0.4]
MarkerStyle
— Group marker symbolGroup marker symbol for data values along the coordinate rulers, specified in one of these forms:
Character vector designating a marker style
String array or cell array of character vectors designating one or more marker styles
Choose among these marker options.
Value | Description |
---|---|
'o' | Circle |
'+' | Plus sign |
'*' | Asterisk |
'.' | Point |
'x' | Cross |
'_' | Horizontal line |
'|' | Vertical line |
'square' or 's' | Square |
'diamond' or 'd' | Diamond |
'^' | Upward-pointing triangle |
'v' | Downward-pointing triangle |
'>' | Right-pointing triangle |
'<' | Left-pointing triangle |
'pentagram' or 'p' | Five-pointed star (pentagram) |
'hexagram' or 'h' | Six-pointed star (hexagram) |
'none' | No markers |
By default, parallelplot
assigns 'none'
as
the marker style for each group. When the total number of groups exceeds the number of
specified symbols, parallelplot
cycles through the specified
symbols.
Example: p = parallelplot(__,'MarkerStyle','x')
Example: p.MarkerStyle = {'x','o'}
MarkerSize
— Group marker sizeGroup marker size for data values along the coordinate rulers, specified as a
nonnegative scalar or nonnegative vector, with values measured in points. By default,
parallelplot
assigns 6
as the marker size for
each group. When the total number of groups exceeds the number of specified values,
parallelplot
cycles through the specified values.
Example: p = parallelplot(__,'MarkerSize',10)
Example: p.MarkerSize = [4 6 8]
FontName
— Font nameFont name, specified as a system-supported font name. The same font is used for the title, labels, legend title, and group names. The default font depends on the specific operating system and locale.
Example: p = parallelplot(__,'FontName','Cambria')
Example: p.FontName = 'Helvetica'
FontSize
— Font sizeFont size, specified as a positive scalar. FontSize
is the same
for the title, labels, legend title, and group names. The default font size depends on
the specific operating system and locale.
As you adjust the size of plot elements, the software automatically updates the font
size. However, changing the FontSize
property disables this
automatic resizing.
Example: p = parallelplot(__,'FontSize',12)
Example: p.FontSize = 10
PositionConstraint
— Position to hold constant'outerposition'
| 'innerposition'
Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:
'outerposition'
— The OuterPosition
property remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the InnerPosition
property.
'innerposition'
— The InnerPosition
property remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the OuterPosition
property.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout
.
InnerPosition
— Inner size and positionInner size and position of the plot within the parent container (typically a figure,
panel, or tab), specified as a four-element numeric vector of the form [left
bottom width height]
. The inner position does not include the plot title,
labels, or legend.
The left
and bottom
elements define the
distance from the lower left corner of the container to the lower left corner of the
plot.
The width
and height
elements are the
dimensions of the plot.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout
.
OuterPosition
— Outer size and position[0 0 1 1]
(default) | four-element numeric vectorOuter size and position of the full parallel coordinates plot within the parent
container (typically a figure, panel, or tab), specified as a four-element numeric
vector of the form [left bottom width height]
. The default value of
[0 0 1 1]
includes the whole interior of the container.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout
.
Position
— Inner size and positionInner size and position of the plot within the parent container (typically a figure,
panel, or tab), specified as a four-element numeric vector of the form [left
bottom width height]
. This property is equivalent to the InnerPosition
property.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout
.
Units
— Position units'normalized'
(default) | 'inches'
| 'centimeters'
| 'points'
| 'pixels'
| 'characters'
Position units, specified as one of these values.
Value | Description |
---|---|
'normalized' (default) | Normalized with respect to the container, which is typically the figure
or a panel. The lower left corner of the container maps to
(0,0) , and the upper right corner maps to
(1,1) . |
'inches' | Inches. |
'centimeters' | Centimeters. |
'characters' | Based on the default uicontrol font of the graphics root object:
|
'points' | Typography points. One point equals 1/72 inch. |
'pixels' | Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows® and Macintosh systems:
On Linux® systems, the size of a pixel is determined by your system resolution. |
When specifying the units as a name-value pair during object creation, you must set
the Units
property before specifying the properties that you want
to use these units for, such as OuterPosition
.
Layout
— Layout optionsLayoutOptions
array (default) | TiledChartLayoutOptions
object | GridLayoutOptions
objectLayout options, specified as a TiledChartLayoutOptions
or
GridLayoutOptions
object. This property is useful when the chart
is either in a tiled chart layout or a grid layout.
To position the chart within the grid of a tiled chart layout, set the
Tile
and TileSpan
properties on the
TiledChartLayoutOptions
object. For example, consider a 3-by-3
tiled chart layout. The layout has a grid of tiles in the center, and four tiles along
the outer edges. In practice, the grid is invisible and the outer tiles do not take up
space until you populate them with axes or charts.
This code places the chart c
in the third tile of the
grid..
c.Layout.Tile = 3;
To make the chart span multiple tiles, specify the TileSpan
property as a two-element vector. For example, this chart spans 2
rows and 3
columns of
tiles.
c.Layout.TileSpan = [2 3];
To place the chart in one of the surrounding tiles, specify the
Tile
property as 'north'
,
'south'
, 'east'
, or 'west'
.
For example, setting the value to 'east'
places the chart in the tile
to the right of the
grid.
c.Layout.Tile = 'east';
To place the chart into a layout within an app, specify this property as a
GridLayoutOptions
object. For more information about working with
grid layouts in apps, see uigridlayout
.
If the chart is not a child of either a tiled chart layout or a grid layout (for example, if it is a child of a figure or panel) then this property is empty and has no effect.
Visible
— Visibility of object'on'
(default) | on/off logical valueVisibility of 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
ParallelCoordinatesPlot
object.
'off'
— Hide the
ParallelCoordinatesPlot
object without deleting it. You can
still access the properties of an invisible
ParallelCoordinatesPlot
object.
CoordinateVariables
— Table variables to display as coordinatesTable variables to display as coordinates, specified in one of these forms:
Numeric vector — Indicating the indices of the table variables
String array or cell array of character vectors — Indicating the names of the table variables
Logical vector — Containing true
elements for the
selected table variables
If you set the CoordinateVariables
property value, then the
CoordinateData
and CoordinateTickLabels
properties update to appropriate values.
Note
The property is ignored and read-only when you use matrix data instead of tabular data.
Example: p.CoordinateVariables = {'Age','Height','Weight'}
specifies the variables named 'Age'
, 'Height'
, and
'Weight'
.
GroupVariable
— Table variable for grouping dataTable variable for grouping data, specified in one of these forms:
Character vector or string scalar — Indicating one of the table variable names
Numeric scalar — Indicating the table variable index
Logical vector — Containing one true
element for the
table variable
The values associated with your table variable must form a numeric vector, logical vector, categorical array, string array, or cell array of character vectors.
GroupVariable
splits the rows in
SourceTable
into unique groups. parallelplot
assigns each group a default color. In the legend, parallelplot
displays the group names in order of their first appearance in
GroupData
.
When you specify GroupVariable
, MATLAB updates the GroupData
property values.
Note
This property is ignored and read-only when you use matrix data instead of tabular data.
Example: p.GroupVariable = 'Smoker'
Data
— Input dataInput data, specified as a numeric matrix.
Note
If you are using tabular data, you cannot set this property.
CoordinateData
— Variables displayed as coordinatesVariables displayed as coordinates, specified in one of these forms:
Numeric vector — Indicating the columns of the source table or input data matrix
Logical vector — Containing true
elements for the
selected columns of the source table or input data matrix
Note
If you are using tabular data, you cannot set this property. The value of
CoordinateData
automatically updates based on the table
variables you select with the CoordinateVariables
property.
Example: p.CoordinateData = [1 5:7]
GroupData
— Values for grouping dataValues for grouping data, specified as a numeric vector, logical vector, categorical array, string array, or cell array of character vectors.
GroupData
splits the rows in SourceTable
or Data
into unique groups. parallelplot
assigns each group a default color. In the legend, parallelplot
displays the group names in order of their first appearance in
GroupData
.
Note
If you are using tabular data, you cannot set this property. The
GroupData
values automatically populate based on the table
variable you select with the GroupVariable
property.
Example: p.GroupData = [1 2 1 3 2 1 3 3 2 3]
Example: p.GroupData =
categorical({'blue','red','yellow','blue','yellow','red','red','yellow','blue','red'})
Parent
— Parent containerFigure
object | Panel
object | Tab
object | TiledChartLayout
object | GridLayout
objectParent container, specified as a Figure
,
Panel
, Tab
,
TiledChartLayout
, or GridLayout
object.
HandleVisibility
— Visibility of object handle'on'
(default) | 'off'
| 'callback'
Visibility of the object handle for ScatterHistogramChart
in the Children
property of the
parent, specified as one of these values:
'on'
— Object handle is always visible.
'off'
— Object handle is always invisible. This
option is useful for preventing unintended changes to the UI by another function.
To temporarily hide the handle during the execution of that function, set the
HandleVisibility
to 'off'
.
'callback'
— Object handle is visible from within
callbacks or functions invoked by callbacks, but not from within functions invoked
from the command line. This option blocks access to the object at the command
line, but allows callback functions to access it.
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. These functions include get
, findobj
, gca
, gcf
, gco
, newplot
, cla
, clf
, and close
.
Hidden object handles are still valid. Set the root
ShowHiddenHandles
property to 'on'
to list all
object handles, regardless of their HandleVisibility
property
setting.
ActivePositionProperty
is not recommendedNot recommended starting in R2020a
Starting in R2020a, setting or getting ActivePositionProperty
is not
recommended. Use the PositionConstraint
property instead.
There are no plans to remove ActivePositionProperty
at this time, but the
property is no longer listed when you call the set
,
get
, or properties
functions on the chart
object.
To update your code, make these changes:
Replace all instances of ActivePositionProperty
with
PositionConstraint
.
Replace all references to the 'position'
option with the
'innerposition'
option.