WordCloudChart - Control word cloud chart appearance and behavior - MATLAB (original) (raw)
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 ofWordData
. If Color
is a matrix, then each row corresponds to an RGB triplet for the corresponding word inWordData
.
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 from0
toF
. 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 |
---|---|
"gem" — Light theme default_Before R2025a: Most plots use these colors by default._ | ![]() |
"glow" — Dark theme 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 from0
toF
. 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 |
---|---|
"gem" — Light theme default_Before R2025a: Most plots use these colors by default._ | ![]() |
"glow" — Dark theme 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 aTiledChartLayout
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
left
andbottom
elements define the distance from the lower left corner of the container to the lower left corner of the word cloud. - The
width
andheight
elements are the word cloud dimensions.
Note
Setting this property has no effect when the parent container is aTiledChartLayout
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 aTiledChartLayout
object.
Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:
"outerposition"
— TheOuterPosition
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 theInnerPosition
property."innerposition"
— TheInnerPosition
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 theOuterPosition
property.
Note
Setting this property has no effect when the parent container is aTiledChartLayout
object.
Units used by OuterPosition
property, specified as'normalized'
, 'points'
,'pixels'
, 'characters'
,'inches'
, or 'centimeters'
.
Layout options, specified as a TiledChartLayoutOptions
orGridLayoutOptions
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 theTile
and TileSpan
properties on theTiledChartLayoutOptions
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.
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 theTile
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.
To place the chart into a layout within an app, specify this property as aGridLayoutOptions
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.
Parent/Child
Parent container, specified as a Figure
,Panel
, Tab
,TiledChartLayout
, or GridLayout
object.
Version History
Introduced in R2017b
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
withPositionConstraint
. - Replace all references to the
"position"
option with the"innerposition"
option.