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

expand all

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

expand all

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 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'

'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 TripletHexadecimal Color CodeAppearance
[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]

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 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'

'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 TripletHexadecimal Color CodeAppearance
[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]

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 one of these values:

  • '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

expand all

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

expand all

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.

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 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.

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.

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 used by OuterPosition property, specified as 'normalized', 'points', 'pixels', 'characters', 'inches', or 'centimeters'.

Layout options, specified as a TiledChartLayoutOptions object. This property specifies options when the chart is a child of a tiled chart layout. Use this property to position the chart within the layout by setting the Tile and TileSpan properties on the TiledChartLayoutOptions object.

For example, this code places chart c in the third tile of a tiled chart layout.

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];

If the chart is not a child of a tiled chart 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 one of these values:

  • 'on' — Display the object.

  • 'off' — Hide the object without deleting it. You still can access the properties of an invisible object.

Parent/Child

expand all

Parent container, specified as a Figure, Panel, Tab, or TiledChartLayout 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. 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.

Introduced in R2017b