wordcloud — Create a word cloud chart from text, tokenized documents, bag models, categorical arrays, tables, or word-size data.

wordcloud creates a WordCloudChart compatibility handle. RunMat supports the common MATLAB forms for raw text, tokenizedDocument, bagOfWords, bagOfNgrams, categorical, words with sizeData, and table word/size variables.

Syntax

wc = wordcloud(str)
wc = wordcloud(documents)
wc = wordcloud(bag)
wc = wordcloud(words, sizeData)
wc = wordcloud(tbl, wordVar, sizeVar)
wc = wordcloud(C)
wc = wordcloud(parent, ...)
wc = wordcloud(..., Name, Value)

Inputs

NameTypeRequiredDefaultDescription
dataAnyYesText, tokenizedDocument, bag model, categorical array, or LDA model.
wordsAnyYesWord vector.
sizeDataNumericArrayYesWord size vector.
tblAnyYesTable with word and size variables.
wordVarAnyYesTable variable containing words.
sizeVarAnyYesTable variable containing word sizes.
NameValueAnyVariadicWordCloudChart name-value properties.

Returns

NameTypeDescription
wcNumericScalarHandle to the WordCloudChart object.

Errors

IdentifierWhenMessage
RunMat:wordcloud:InvalidArgumentInput data, table selectors, parent axes, or WordCloudChart properties are invalid.wordcloud: invalid argument
RunMat:wordcloud:InternalInternal plotting state update fails while creating or mutating a word cloud.wordcloud: internal operation failed

How wordcloud works

  • wordcloud(str) tokenizes string, character, string-array, or cellstr input, removes common English stop words, counts words, and renders the most frequent words.
  • wordcloud(documents) accepts RunMat tokenizedDocument compatibility objects and counts tokens from their Documents property.
  • wordcloud(bag) accepts RunMat bagOfWords and bagOfNgrams compatibility objects and sums each column of Counts; n-gram labels are joined with spaces.
  • wordcloud(words,sizeData) accepts a word vector and a numeric vector with the same element count. Duplicate words are aggregated and zero-sized entries are omitted.
  • wordcloud(tbl,wordVar,sizeVar) accepts RunMat table/timetable compatibility objects where wordVar and sizeVar are variable names or scalar variable indices.
  • wordcloud(C) accepts RunMat categorical compatibility objects and uses category counts as word sizes.
  • wordcloud(parent,...) accepts a leading RunMat figure parent and uses that figure's active axes for rendering. Encoded axes handles are also accepted as a RunMat plotting compatibility extension.
  • Supported name-value options are MaxDisplayWords, Color, HighlightColor, Shape (oval or rectangle), LayoutNum, SizePower, Title, TitleFontName, Visible, FontName, Box, Units, Position, HandleVisibility, DisplayName, and Tag.
  • MaxDisplayWords is capped at 1000 rendered annotation slots in RunMat to keep chart creation bounded.
  • get supports Type, Parent, Children, WordData, SizeData, WordVariable, SizeVariable, SourceTable, MaxDisplayWords, Color, HighlightColor, Shape, LayoutNum, SizePower, Title, TitleFontName, FontName, Visible, Box, Units, Position, HandleVisibility, DisplayName, and Tag.
  • set supports WordData, SizeData, MaxDisplayWords, Color, HighlightColor, Shape, LayoutNum, SizePower, Title, TitleFontName, FontName, Visible, Box, Units, Position, HandleVisibility, DisplayName, and Tag; WordData and SizeData assignments must preserve matching lengths.
  • RunMat uses a deterministic annotation layout rather than MATLAB's exact proprietary word-placement algorithm. FontName, TitleFontName, Units, Position, and HandleVisibility are stored as chart metadata; the current plotting renderer does not yet expose a separate chart-container layout or font-family path. LDA topic word clouds remain unsupported until ldaModel compatibility exists and raise an explicit tracked-gap error.

Examples

Create a word cloud from text

txt = "runmat computes fast math and runmat plots math";
wc = wordcloud(txt);

Create a word cloud from explicit word sizes

words = ["alpha" "beta" "gamma"];
sizes = [5 9 2];
wc = wordcloud(words, sizes, 'MaxDisplayWords', 2, 'Shape', 'rectangle');
get(wc, 'WordData')

Create a word cloud from a table

tbl = table(["alpha";"beta"], [10;4], 'VariableNames', {'Word','Count'});
wc = wordcloud(tbl, 'Word', 'Count');

Using wordcloud with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how wordcloud changes the result.

Run a small wordcloud example, explain the result, then change one input and compare the output.

FAQ

Does wordcloud return a graphics object?

Yes. RunMat returns a first-class wordcloud chart handle with readable and mutable chart properties through get and set.

Does RunMat match MATLAB's exact word placement?

No. RunMat computes MATLAB-compatible word labels, sizes, and chart properties, then uses a deterministic annotation layout. Exact MATLAB layout parity remains tracked by the Text Analytics umbrella.

Can wordcloud preserve gpuArray residency?

No. Word clouds are text/chart rendering sinks over host text, table, categorical, and bag metadata, so provider-resident numeric kernels are not applicable to this slice.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how wordcloud is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.