3-D scatter plot of text (2024)

3-D scatter plot of text

collapse all in page

Syntax

ts = textscatter3(x,y,z,str)

ts = textscatter3(xyz,str)

ts = textscatter3(ax,___)

ts = textscatter3(___,Name,Value)

Description

example

ts = textscatter3(x,y,z,str) creates a 3-D text scatter plot with elements of str at the locations specified by the vectors x, y, and z.

example

ts = textscatter3(xyz,str) creates a 3-D text scatter plot with elements of str at the locations specified by the rows of xyz. This syntax is equivalent to textscatter(xyz(:,1),xyz(:,2),xyz(:,3),str).

ts = textscatter3(ax,___) plots into axes object ax. Use this syntax with any of the input arguments in previous syntaxes.

example

ts = textscatter3(___,Name,Value) specifies additional TextScatter properties using one or more name-value pair arguments.

Examples

collapse all

Create 3-D Text Scatter Plot

Open Live Script

Plot a string array of numbers at random points on a 3-D text scatter plot.

x = rand(50,1);y = rand(50,1);z = rand(50,1);str = string(1:50);figuretextscatter3(x,y,z,str);

3-D scatter plot of text (1)

Alternatively, you can pass the coordinates x, y, and z as a matrix xyz, where x, y, and z are the columns of xyz.

xyz = [x y z];figuretextscatter3(xyz,str)

3-D scatter plot of text (2)

Open Live Script

Create text scatter plot of a word embedding and specify word colors.

Load a pretrained word embedding using fastTextWordEmbedding. This function requires Text Analytics Toolbox™ Model for fastText English 16 Billion Token Word Embedding support package. If this support package is not installed, then the function provides a download link.

emb = fastTextWordEmbedding;

Convert the first 250 words to vectors using word2vec. V is a matrix of word vectors of length 300.

words = emb.Vocabulary(1:250);V = word2vec(emb,words);size(V)
ans = 1×2 250 300

Embed the word vectors in a 3-D space using tsne.

XYZ = tsne(V,'NumDimensions',3);

Plot the words at the coordinates specified by XYZ in a 3-D text scatter plot. Specify the word colors to be random.

numWords = numel(words);colorData = rand(numWords,3);figuretextscatter3(XYZ,words,'ColorData',colorData)title("Word Embedding t-SNE Plot")

3-D scatter plot of text (3)

Input Arguments

collapse all

xx values
vector

x values, specified as a vector. x, y, z, and str must be of equal length.

Example: [1 2 3]

yy values
vector

y values, specified as a vector. x, y, z, and str must be of equal length.

Example: [1 2 3]

zz values
vector

z values, specified as a vector. x, y, z, and str must be of equal length.

Example: [1 2 3]

xyzx, y, and z values
matrix

x, y, and z values, specified as a matrix. The first, second, and third columns of xyz correspond to the x, y, and z values, respectively.

strInput text
string vector | cell array of character vectors

Input text, specified as a string vector or cell array of character vectors. x, y, z, and str must be of equal length.

Example: ["one" "two" "three"]

Data Types: string | cell

axAxes object
axes object

Axes object. If you do not specify an axes object, then the function uses the current axes.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Marker','*' specifies the markers to be asterisks.

The TextScatter object properties listed here are only a subset. For a complete list, see TextScatter Properties.

TextDensityPercentagePercentage of text data to show
60 (default) | scalar from 0 through 100

Percentage of text data to show, specified as a scalar from 0 through 100. To show all text, set TextDensityPercentage to 100. To show no text, set TextDensityPercentage to 0.

If you set TextDensityPercentage to 100, then the software does not plot markers.

Example: 70

MaxTextLengthMaximum length of text labels
40 (default) | positive integer

Maximum length of text labels, specified as a positive integer. The software truncates the text labels to this length and adds ellipses at the point of truncation.

Example: 10

MarkerColorMarker colors
'auto' (default) | 'none' | RGB triplet

Marker colors, specified as one of these values:

  • 'auto' — For each marker, use the same color as the corresponding text labels.

  • 'none' — Do not show markers.

  • RGB triplet — Use the same color for all the markers in the plot. 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.5 0.6 0.7].

Example: [1 0 0]

ColorDataText colors
[] (default) | RGB triplet | matrix of RGB triplets | categorical vector

Text colors, specified as one of these values:

  • RGB triplet — Use the same color for all the text in the plot. 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.5 0.6 0.7].

  • Three-column matrix of RGB triplets — Use a different color for each text label in the plot. Each row of the matrix defines one color. The number of rows must equal the number of text labels.

  • Categorical vector — Use a different color for each category in the vector. Specify ColorData as a vector the same length as XData. Specify the colors for each category using the Colors property

Example: [1 0 0; 0 1 0; 0 0 1]

ColorsCategory colors
matrix of RGB triplets

Category colors, specified as a matrix of RGB triplets. 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.5 0.6 0.7].

By default, Colors is equal to the ColorOrder property of the axes object.

Example: [1 0 0; 0 1 0; 0 0 1]

Output Arguments

collapse all

tsTextScatter object
TextScatter object

TextScatter object. Use ts to access and modify properties of the text scatter chart after it has been created. For more information, see TextScatter Properties.

Version History

Introduced in R2017b

See Also

wordcloud | textscatter | tokenizedDocument | fastTextWordEmbedding | wordEmbedding | word2vec

Topics

  • Visualize Text Data Using Word Clouds
  • Visualize Word Embeddings Using Text Scatter Plots
  • Prepare Text Data for Analysis

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.

3-D scatter plot of text (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • 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
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

3-D scatter plot of text (2024)

FAQs

What is a 3-dimensional scatter plot? ›

3D scatter plots are used to plot data points on three axes in the attempt to show the relationship between three variables. Each row in the data table is represented by a marker whose position depends on its values in the columns set on the X, Y, and Z axes.

How do you plot a scatter plot in D3? ›

How to create a scatter plot using D3
  1. Step 1: Dataset. Before even starting to code, we need a data set to base our chart on. ...
  2. Step 2: D3 and SVG container. ...
  3. Step 3: Set margin. ...
  4. Step 4: Set scale. ...
  5. Step 5: Add text. ...
  6. Step 6: Add axis. ...
  7. Step 7: Scatter dots.
Mar 19, 2021

How to make an xyz scatter plot? ›

Create Chart

After adding data, go to the 'Traces' section under the 'Structure' menu on the left-hand side. Choose the 'Type' of trace, then choose '3D Scatter' under '3D' chart type. Next, select 'X', 'Y' and 'Z' values from the dropdown menus. This will create a 3D scatter trace, as seen below.

Can you do a 3D scatter plot in Excel? ›

The 3D scatter plot chart in Excel is mainly used to show the relationship between two sets of data related to each other. The scattered chart has X and Y variables. This chart helps show related data like rainfall vs. umbrellas sold, rainfall vs.

What is a 3 way scatter plot? ›

Unlike a classic XY scatter chart, a 3D scatter plot displays data points on three axes (x, y, and z) in order to show the relationship between three variables. Therefore, it is often called an XYZ plot.

How to create a scatter plot? ›

Create a scatter chart

Select the data you want to plot in the chart. Click the Insert tab, and then click X Y Scatter, and under Scatter, pick a chart. With the chart selected, click the Chart Design tab to do any of the following: Click Add Chart Element to modify details like the title, labels, and the legend.

How do you start a scatter plot? ›

The basic steps to make a scatter plot in Excel:
  1. Highlight data you want to plot.
  2. Go to the “Insert” tab.
  3. Find the “Charts” section.
  4. Click on the scatter plot icon.
  5. Edit ranges, axis titles, chart title, and anything else you want to adjust.

How do you graph data in a scatter plot? ›

Scatter Diagram Procedure

Collect pairs of data where a relationship is suspected. Draw a graph with the independent variable on the horizontal axis and the dependent variable on the vertical axis. For each pair of data, put a dot or a symbol where the x-axis value intersects the y-axis value.

How to make a 3D scatter plot in Origin? ›

organize the data columns as X, XErr, Y, YErr and Z, then highlight them all to plot a 3D scatter plot. add X, Y and Z error bars to the graph after it is created by clicking Format: Plot, then clicking on the Error Bar tab of Plot Details and designating error bar datasets.

How to make 3D scatter plots? ›

Generally 3D scatter plot is created by using ax. scatter3D() the function of the matplotlib library which accepts a data sets of X, Y and Z to create the plot while the rest of the attributes of the function are the same as that of two dimensional scatter plot.

How do you rotate a 3D scatter plot? ›

Direct link to this answer
  1. Draw a 3d line plot of the corresponding scatter plot.
  2. Rotate that 3d line plot using the rotate function.
  3. get the data from the line plot and draw the corresponding 3dScatterplot .
Jan 15, 2021

What is a 3-dimensional line plot? ›

The most basic three-dimensional plot is a line or collection of scatter plot created from sets of (x, y, z) triples. In analogy with the more common two-dimensional plots discussed earlier, these can be created using the ax. plot3D and ax. scatter3D functions.

What is 3-dimensional data visualization? ›

3D data visualization is the process of creating three-dimensional representations of data sets. This can include anything from simple graphs and charts to complex models and simulations.

What is a 3-dimensional chart? ›

Unlike 2D charts, which plot data points on a flat plane, 3D charts add depth, allowing for a more immersive and detailed visualization. This added dimension can help reveal patterns and relationships that might not be as apparent in 2D representations.

What is a 3-dimensional surface plot? ›

A 3D surface plot is a three-dimensional graph that is useful for investigating desirable response values and operating conditions. A surface plot contains the following elements: Predictors on the x- and y-axes. A continuous surface that represents the response values on the z-axis.

Top Articles
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 5882

Rating: 4.9 / 5 (79 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.