Control word cloud chart appearance and behavior
WordCloudChart
properties control the
appearance and behavior of a WordCloudChart
object. By
changing property values, you can modify certain aspects of the word cloud
chart.
Title
— Text displayed above word cloud chart in figure''
(default) | character array | cell array of character vectors | string | cell array of strings | numeric value | categorical arrayText displayed above word cloud chart in figure, specified as a character
array, cell array of character vectors, scalar string, cell array of
strings, a numeric value, or a categorical array. If you specify this
property as a categorical array, then MATLAB® uses the values in the array, not the full set of categories.
You can also use the title
function to set this
value.
Example: "Word Cloud"
Data Types: string
| char
| cell
TitleFontName
— Font used for title text in the word cloud chart'Helvetica'
(default) | character vector | stringFont used for title text in the word cloud chart, specified as a string or character vector. To display and print properly, the font name must be a font that your system supports. The default font depends on the specific operating system and locale.
Example: 'Cambria'
Data Types: char
| string
Color
— Word color[0.2510 0.2510 0.2510]
(default) | RGB triplet | character vector containing a color name | matrixWord color, specified as an RGB triplet, a character vector containing a color name,
or an N
-by-3 matrix where N
is the length of
WordData
. If Color
is a matrix, then each
row corresponds to an RGB triplet for the corresponding word in
WordData
.
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 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' |
Example: 'blue'
Example: [0 0 1]
HighlightColor
— Word highlight color[0.8510 0.3255 0.0980]
(default) | RGB triplet | character vector containing a color nameWord highlight color, specified as an RGB triplet, or a character vector containing a color name. The software highlights the largest words with this color.
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 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' |
Example: 'blue'
Example: [0 0 1]
FontName
— Font used for text in the word cloud chart'Helvetica'
(default) | character vector | stringFont used for text in the word cloud chart, specified as a string or character vector. To display and print properly, the font name must be a font that your system supports. The default font depends on the specific operating system and locale.
Example: 'Cambria'
Data Types: char
| string
MaxDisplayWords
— Maximum number of words to displayMaximum number of words to display, specified as a non-negative integer. The software displays
the MaxDisplayWords
largest words.
Box
— Axes box outline'off'
(default) | 'on'
Axes box outline, 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
.
'off'
— Do not display the box
outline around the axes.
'on'
— Display the box outline
around the axes.
Example: 'on'
Shape
— Shape of word cloud'oval'
(default) | 'rectangle'
Shape of word cloud chart, specified as 'oval'
or 'rectangle'
.
Example: 'rectangle'
LayoutNum
— Word placement layoutWord placement layout, specified as a nonnegative integer. If you repeatedly call wordcloud
with the same inputs, then the word placement layouts will be the same each time. To get different word placement layouts, use different values of LayoutNum
.
SizePower
— Power to apply to SizeData
Power to apply to SizeData
, specified as a positive
scalar. The software displays words with sizes given by SizeData .^
SizePower
.
Example: 2
WordData
— Word data""
(default) | string vector | cell array of character vectorsWord data, specified as a string vector, or a cell array of character vectors.
Example:
["one" "two" "three"]
Data Types: string
| cell
SizeData
— Size data[]
(default) | numeric vectorSize data, specified as a numeric vector.
Example: [0.1 0.2 0.3]
WordVariable
— Word variable in source tableWord variable in the source table, specified as a character vector.
Data Types: char
SizeVariable
— Size variable in source tableSize variable in the source table, specified as a character vector.
Data Types: char
SourceTable
— Source tableSource table containing word and size data.
Data Types: table
OuterPosition
— Size and position of word cloud chart within its parent[0 0 1 1]
(default) | 1-by-4 numeric vectorSize and position of word cloud chart within its parent, specified as a
1-by-4 numeric vector of the form
[left,bottom,width,height]
. This includes labels and
margins. 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
.
InnerPosition
— Inner size and position[0 0 1 1]
(default) | 1-by-4 numeric vectorInner size and position of the word cloud within the parent container
(typically a figure, panel, or tab) returned as a 1-by-4 numeric vector of
the form [left bottom width height]
.
The left
and bottom
elements define the distance from the lower left corner of the
container to the lower left corner of the word cloud.
The width
and height
elements are the word cloud dimensions.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout
.
Position
— Inner size and positionInner size and position of the word cloud within the parent container
(typically a figure, panel, or tab) specified as a four-element 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
.
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
.
Units
— Units used by OuterPosition
property'normalized'
(default) | 'points'
| 'pixels'
| 'characters'
| 'inches'
| 'centimeters'
Units used by OuterPosition
property, specified as
'normalized'
, 'points'
,
'pixels'
, 'characters'
,
'inches'
, or 'centimeters'
.
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
— State of visibility'on'
(default) | on/off logical valueState of visibility, 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.
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 in the Children
property
of the parent, specified as one of these values:
'on'
— Object handle is
always visible.
'off'
— Object handle is invisible at
all times. This option is useful for preventing unintended
changes by another function. Set the
HandleVisibility
to
'off'
to temporarily hide the handle
during the execution of that function.
'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 permits
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 it. 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.
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.