WordCloudChart Properties
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, 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
Font 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 and Styling
Word 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 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]
Word 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 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]
Font 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
Maximum number of words to display, specified as a non-negative integer. The software displays
the MaxDisplayWords largest words.
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 of word cloud chart, specified as 'oval' or 'rectangle'.
Example: 'rectangle'
Word 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.
Power to apply to SizeData, specified as a positive
scalar. The software displays words with sizes given by SizeData .^
SizePower.
Example: 2
Data
Word data, specified as a string vector, or a cell array of character vectors.
Example:
["one" "two" "three"]
Data Types: string | cell
Size data, specified as a numeric vector.
Example: [0.1 0.2 0.3]
Word variable in the source table, specified as a character vector.
Data Types: char
Size variable in the source table, specified as a character vector.
Data Types: char
Source table containing word and size data.
Data Types: table
Position
Size 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 object.
Inner 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
leftandbottomelements define the distance from the lower left corner of the container to the lower left corner of the word cloud.The
widthandheightelements are the word cloud dimensions.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout object.
Inner 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 object.
Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:
"outerposition"— TheOuterPositionproperty 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 theInnerPositionproperty."innerposition"— TheInnerPositionproperty 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 theOuterPositionproperty.
Note
Setting this property has no effect when the parent container is a
TiledChartLayout object.
Units used by OuterPosition property, specified as
'normalized', 'points',
'pixels', 'characters',
'inches', or 'centimeters'.
Layout 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.
State 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/Child
Parent container, specified as a Figure,
Panel, Tab,
TiledChartLayout, or GridLayout object.
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. SetHandleVisibilityto"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.
Version History
Introduced in R2017bStarting 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
ActivePositionPropertywithPositionConstraint.Replace all references to the
"position"option with the"innerposition"option.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)