Scatter plot matrix - MATLAB plotmatrix (2024)

Scatter plot matrix

collapse all in page

  • Scatter plot matrix - MATLAB plotmatrix (1)

Syntax

plotmatrix(X,Y)

plotmatrix(X)

plotmatrix(___,LineSpec)

plotmatrix(ax,___)

[S,AX,BigAx,H,HAx]= plotmatrix(___)

Description

example

plotmatrix(X,Y) createsa matrix of subaxes containing scatter plots of the columns of X againstthe columns of Y. If X is p-by-n and Y is p-by-m,then plotmatrix produces an n-by-m matrixof subaxes.

example

plotmatrix(X) is the same as plotmatrix(X,X) except that the subaxes along the diagonal are replaced with histogram plots of the data in the corresponding column of X. For example, the subaxes along the diagonal in the ith column is replaced by histogram(X(:,i)). The tick labels along the edges of the plots align with the scatter plots, not the histograms.

example

plotmatrix(___,LineSpec) specifiesthe line style, marker symbol, and color for the scatter plots. Theoption LineSpec can be preceded by any of the inputargument combinations in the previous syntaxes.

plotmatrix(ax,___) plots into the specified target axes, where the target axes is an invisible frame for the subaxes.

example

[S,AX,BigAx,H,HAx]= plotmatrix(___) returns the graphic objectscreated as follows:

  • S – Chart line objects forthe scatter plots

  • AX – Axes objects for eachsubaxes

  • BigAx – Axes object forbig axes that frames the subaxes

  • H – Histogram objects forthe histogram plots

  • HAx – Axes objects for theinvisible histogram axes

BigAx is left as the current axes (gca)so that a subsequent title, xlabel,or ylabel command centers text with respect tothe big axes.

Examples

collapse all

Create Scatter Plot Matrix with Two Matrix Inputs

Create X as a matrix of random data and Y as a matrix of integer values. Then, create a scatter plot matrix of the columns of X against the columns of Y.

X = randn(50,3);Y = reshape(1:150,50,3); plotmatrix(X,Y)

Scatter plot matrix - MATLAB plotmatrix (2)

The subplot in the ith row, jth column of the figure is a scatter plot of the ith column of Y against the jth column of X.

Create Scatter Plot Matrix with One Matrix Input

Open Live Script

Create a scatter plot matrix of random data. The subplot in the ith row, jth column of the matrix is a scatter plot of the ith column of X against the jth column of X. Along the diagonal are histogram plots of each column of X.

X = randn(50,3); plotmatrix(X)

Scatter plot matrix - MATLAB plotmatrix (3)

Specify Marker Type and Color

Open Live Script

Create a scatter plot matrix of random data. Specify the marker type and the color for the scatter plots.

X = randn(50,3); plotmatrix(X,'*r')

Scatter plot matrix - MATLAB plotmatrix (4)

The LineSpec option sets properties for the scatter plots. To set properties for the histogram plots, return the histogram objects.

Modify Scatter Plot Matrix After Creation

Open Live Script

Create a scatter plot matrix of random data.

rng defaultX = randn(50,3);[S,AX,BigAx,H,HAx] = plotmatrix(X);

Scatter plot matrix - MATLAB plotmatrix (5)

To set properties for the scatter plots, use S. To set properties for the histograms, use H. To set axes properties, use AX, BigAx, and HAx. Use dot notation to set properties.

Set the color and marker type for the scatter plot in the lower left corner of the figure. Set the color for the histogram plot in the lower right corner. Use the title command to title the figure.

S(3).Color = 'g';S(3).Marker = '*'; H(3).EdgeColor = 'k';H(3).FaceColor = 'g'; title(BigAx,'A Comparison of Data Sets')

Scatter plot matrix - MATLAB plotmatrix (6)

Input Arguments

collapse all

XData to display
matrix

Data to display, specified as a matrix.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

YData to plot against X
matrix

Data to plot against X, specified as a matrix.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

LineSpecLine style, marker, and color
string scalar | character vector

Line style, marker, and color, specified as a string scalar or character vector containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.

Example: "--or" is a red dashed line with circle markers.

Line StyleDescriptionResulting Line
"-"Solid line

Scatter plot matrix - MATLAB plotmatrix (7)

"--"Dashed line

Scatter plot matrix - MATLAB plotmatrix (8)

":"Dotted line

Scatter plot matrix - MATLAB plotmatrix (9)

"-."Dash-dotted line

Scatter plot matrix - MATLAB plotmatrix (10)

MarkerDescriptionResulting Marker
"o"Circle

Scatter plot matrix - MATLAB plotmatrix (11)

"+"Plus sign

Scatter plot matrix - MATLAB plotmatrix (12)

"*"Asterisk

Scatter plot matrix - MATLAB plotmatrix (13)

"."Point

Scatter plot matrix - MATLAB plotmatrix (14)

"x"Cross

Scatter plot matrix - MATLAB plotmatrix (15)

"_"Horizontal line

Scatter plot matrix - MATLAB plotmatrix (16)

"|"Vertical line

Scatter plot matrix - MATLAB plotmatrix (17)

"square"Square

Scatter plot matrix - MATLAB plotmatrix (18)

"diamond"Diamond

Scatter plot matrix - MATLAB plotmatrix (19)

"^"Upward-pointing triangle

Scatter plot matrix - MATLAB plotmatrix (20)

"v"Downward-pointing triangle

Scatter plot matrix - MATLAB plotmatrix (21)

">"Right-pointing triangle

Scatter plot matrix - MATLAB plotmatrix (22)

"<"Left-pointing triangle

Scatter plot matrix - MATLAB plotmatrix (23)

"pentagram"Pentagram

Scatter plot matrix - MATLAB plotmatrix (24)

"hexagram"Hexagram

Scatter plot matrix - MATLAB plotmatrix (25)

Color NameShort NameRGB TripletAppearance
"red""r"[1 0 0]

Scatter plot matrix - MATLAB plotmatrix (26)

"green""g"[0 1 0]

Scatter plot matrix - MATLAB plotmatrix (27)

"blue""b"[0 0 1]

Scatter plot matrix - MATLAB plotmatrix (28)

"cyan" "c"[0 1 1]

Scatter plot matrix - MATLAB plotmatrix (29)

"magenta""m"[1 0 1]

Scatter plot matrix - MATLAB plotmatrix (30)

"yellow""y"[1 1 0]

Scatter plot matrix - MATLAB plotmatrix (31)

"black""k"[0 0 0]

Scatter plot matrix - MATLAB plotmatrix (32)

"white""w"[1 1 1]

Scatter plot matrix - MATLAB plotmatrix (33)

axTarget axes
Axes object

Target axes that frames all the subaxes, specified as an Axes object. If you do not specify this argument, then plotmatrix uses the current axes.

Output Arguments

collapse all

S — Chart line objects for scatter plots
matrix

Chart line objects for the scatter plots, returned as a matrix.These are unique identifiers, which you can use to query and modifythe properties of a specific scatter plot.

AX — Axes objects for subaxes
matrix

Axes objects for the subaxes, returned as a matrix. These areunique identifiers, which you can use to query and modify the propertiesof a specific subaxes.

BigAx — Axes object for big axes
scalar

Axes object for big axes, returned as a scalar. This is a uniqueidentifier, which you can use to query and modify properties of thebig axes.

H — Histogram objects
vector | []

Histogram objects, returned as a vector or []. These are unique identifiers, which you can use to query and modify the properties of a specific histogram object. If no histogram plots are created, then H is returned as empty brackets.

HAx — Axes objects for invisible histogram axes
vector | []

Axes objects for invisible histogram axes, returned as a vectoror []. These are unique identifiers, which youcan use to query and modify the properties of a specific axes. Ifno histogram plots are created, then HAx is returnedas empty brackets.

Extended Capabilities

Version History

Introduced before R2006a

expand all

The H output argument is now a vector of histogram objects. In previous releases, it was a vector of patch objects.

See Also

scatter | scatter3 | tiledlayout | nexttile

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.

Scatter plot matrix - MATLAB plotmatrix (34)

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

Scatter plot matrix - MATLAB plotmatrix (2024)

FAQs

How do you make a scatter plot matrix in Matlab? ›

Create a scatter plot matrix of random data. rng default X = randn(50,3); [S,AX,BigAx,H,HAx] = plotmatrix(X); To set properties for the scatter plots, use S . To set properties for the histograms, use H .

How to understand scatter plot matrix? ›

A scatter plot matrix is a grid (or matrix) of scatter plots used to visualize bivariate relationships between combinations of variables. Each scatter plot in the matrix visualizes the relationship between a pair of variables, allowing many relationships to be explored in one chart.

How to plot an identity matrix in Matlab? ›

I = eye( n , m ) returns an n -by- m matrix with ones on the main diagonal and zeros elsewhere. I = eye( sz ) returns an array with ones on the main diagonal and zeros elsewhere. The size vector, sz , defines size(I) . For example, eye([2,3]) returns a 2-by-3 array with ones on the main diagonal and zeros elsewhere.

How to plot a matrix graph? ›

There are many different ways to create a matrix plot, but the most common method is to use a scatter plot. To create a scatter plot, you will need to have three columns of data: one for the x-axis, one for the y-axis, and one for the z-axis. Each row of data will then correspond to a point in the matrix.

How do you create a matrix in MATLAB? ›

To create an array with four elements in a single row, separate the elements with either a comma ( , ) or a space. This type of array is a row vector. To create a matrix that has multiple rows, separate the rows with semicolons. Another way to create a matrix is to use a function, such as ones , zeros , or rand .

How do you customize a scatter plot in MATLAB? ›

To plot each circle with a different size, specify sz as a vector or a matrix. scatter( x , y , sz , c ) specifies the circle colors. You can specify one color for all the circles, or you can vary the color. For example, you can plot all red circles by specifying c as "red" .

How to calculate the scatter matrix? ›

Let M = ∑i = 0CMi be the total number of samples. Now, scatter matrix is calculated as within-class matrix by between-class matrix. where μ = 1 C ∑ i = 1 C μ i mean of entire dataset. where UT is projection matrix.

What are the advantages of scatter plot matrix? ›

A scatter plot matrix can show how multiple variables are related. After plotting all the two-way combinations of the variables, the matrix can show relationships between variables to highlight which relationships are likely to be important. The matrix can also identify outliers in multiple scatter plots.

What are the 4 ways to describe a scatter plot? ›

When we look at a scatterplot, we should be able to describe the association we see between the variables.

What is the difference between matrix and array in MATLAB? ›

Matrix operations follow the rules of linear algebra. By contrast, array operations execute element by element operations and support multidimensional arrays. The period character ( . ) distinguishes the array operations from the matrix operations.

What is the trace of a matrix in MATLAB? ›

Description. b = trace( A ) calculates the sum of the diagonal elements of matrix A : tr ( A ) = ∑ i = 1 n a i i = a 11 + a 22 + ... + a n n .

How do you plot a contour matrix in MATLAB? ›

contour( ax ,___) displays the contour plot in the target axes. Specify the axes as the first argument in any of the previous syntaxes. M = contour(___) returns the contour matrix M , which contains the (x, y) coordinates of the vertices at each level.

How to make a scatter plot of a matrix? ›

Create a Simple Matrix of Scatter Plots
  1. Select Graph >> Matrix plot...
  2. Under Matrix of plots, select the Simple plot.
  3. In the box labeled Graph variables, specify the variables you want to include in your plot.
  4. Select OK. A new graph window should appear containing the scatter plot matrix.

What is the difference between a scatter plot and a scatter plot matrix? ›

For a set of data variables (dimensions) X1, X2, ... , Xk, the scatter plot matrix shows all the pairwise scatter plots of the variables on a single view with multiple scatterplots in a matrix format. For k variables, the scatterplot matrix will contain k rows and k columns.

How do you create a grid matrix in MATLAB? ›

You can create x1g and x2g using the MATLAB meshgrid command. Given two free variables, x1 and x2, you can create the first and second coordinate matrices of a grid by entering: >> [x1g,x2g]=meshgrid(x1,x2);

How to create a matrix from Excel data in MATLAB? ›

Create MATLAB Matrix

Create a matrix in the MATLAB Workspace using the MLPutMatrix function in an Excel® worksheet. Enter the values 1 through 5 in cells A1 through E1 . Define the name testData for the range of cells A1 through E1 . For instructions on defining names, see Excel Help.

How do you create a multidimensional matrix in MATLAB? ›

You can create a multidimensional array by creating a 2-D matrix first, and then extending it. For example, first define a 3-by-3 matrix as the first page in a 3-D array. Now add a second page. To do this, assign another 3-by-3 matrix to the index value 2 in the third dimension.

Top Articles
10 Baby Led Weaning Dinner Ideas Your Whole Family Will Love
10 Obat Batuk Herbal untuk Anak, Murah Bisa Bikin Sendiri - idNarmadi
Beau Is Afraid Showtimes Near Island 16 Cinema De Lux
Google Jobs Denver
Royal Bazaar Farmers Market Tuckernuck Drive Richmond Va
Is Jennifer Coffindaffer Married
Att Login Prepaid
Kathy Carrack
Surya Grahan 2022 Usa Timings
Chris Evert Twitter
Star Rug Aj Worth
Chlamydia - Chlamydia - MSD Manual Profi-Ausgabe
Dcuo Exalted Style
Staples Ups Drop Off
Kup telewizor LG OLED lub QNED i zgarnij do... 3000 zł zwrotu na konto! Fantastyczna promocja
Best Fantime Accounts
Vioc Credit Card Charge
Bfri Forum
Pella Culver's Flavor Of The Day
Eureka Mt Craigslist
Abby's Caribbean Cafe
Mtvkay21
Lvaction Login
Why Zero Raised to the Zero Power is defined to be One « Mathematical Science & Technologies
Nenas Spa San Salvador
Ts Central Nj
Https Eresponse Tarrantcounty Com
Dl Delta Extranet
Savannah Schultz Leaked
9 best hotels in Atlanta to check out in 2023 - The Points Guy
Dvax Message Board
Bianca Censo
Elaina Scotto Wedding
Retro Bowl Unblocked Game 911: A Complete Guide - Unigamesity
The Top 6 Most Expensive Hermès Birkin Bags
National Weather Service Pittsburgh Pa
600 Aviator Court Vandalia Oh 45377
Now 81, Wayne Newton Will Soon Mark 65 Years as Mr. Las Vegas
Where Is Item Number On Stanley Cup
Ohio State Football Wiki
Information on Fluorinated Waxes – FasterSkier.com
Watkins Brothers Funeral Homes Macdonald Chapel Howell Obituaries
When is the next full moon? September's Harvest Moon is also super
Jasper William Oliver Cable Alexander
Tapana Movie Online Watch 2022
Vidcloud Membed
Potomac Edison Wv Outages
Craigslist West Valley
Salmon Fest 2023 Lineup
Basketball Stars Unblocked 66 Ez
Kentucky TikTok: 12 content Bluegrass State creators to know
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 6674

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.