필터 지우기
필터 지우기

Grid_style plot

조회 수: 1 (최근 30일)
root
root 2023년 12월 4일
댓글: Walter Roberson 2023년 12월 5일
This code plots the car data in gride style plot but the variables are not clearly shown on the axis
( it only shows var1:var19 but i want the actual names on the plot)
%% Load the dataset
cars04 = readtable('cars-fixed04.dat');
%% Extract numerical features
numerical_data = table2array(cars04(:, 9:19));
%% Create a grid-style pairwise plot with increased figure size
figure('Position', [100, 100, 1200, 800]); % Adjust the values as needed
xnames = cars04.Properties.VariableNames(9:19);
ynames = cars04.Var1;
h = gplotmatrix(numerical_data, [], cars04.Var2, 'br', '.', 8, 'on',[],xnames,ynames);
The data couldnt be attached but it is displayed like this
cars04 =
387×19 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19
______________________________________________ ____ ____ ____ ____ ____ ____ ____ __________ __________ _____ _____ _____ _____ _____ _____ _____ _____ _____
{'Acura 3.5 RL' } 0 0 0 0 0 0 0 43755 39014 3.5 6 225 18 24 3880 115 197 72
{'Acura 3.5 RL Navigation' } 0 0 0 0 0 0 0 46100 41100 3.5 6 225 18 24 3893 115 197 72
{'Acura MDX' } 0 1 0 0 0 1 0 36945 33337 3.5 6 265 17 23 4451 106 189 77
{'Acura NSX S' } 1 0 0 0 0 0 1 89765 79978 3.2 6 290 17 24 3153 100 174 71
{'Acura RSX' } 0 0 0 0 0 0 0 23820 21761 2 4 200 24 31 2778 101 172 68
{'Acura TL' } 0 0 0 0 0 0 0 33195 30299 3.2 6 270 20 28 3575 108 186 72
{'Acura TSX' } 0 0 0 0 0 0 0 26990 24647 2.4 4 200 22 29 3230 105 183 69
{'Audi A4 1.8T' } 0 0 0 0 0 0 0 25940 23508 1.8 4 170 22 31 3252 104 179 70

답변 (1개)

Walter Roberson
Walter Roberson 2023년 12월 4일
( it only shows var1:var19 but i want the actual names on the plot)
That is what it is plotting.
387×19 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19
Those "Var" are the variable names.
  댓글 수: 2
root
root 2023년 12월 4일
Thank you Walter! Then how do we display the car names which are shown on column 1? I was expecting the grid plot to show Var names on x axis and car names in y axis. Am I missing something ?
Walter Roberson
Walter Roberson 2023년 12월 5일
You are trying to use the syntax
gplotmatrix(X,Y,group,clr,sym,siz,doleg,[],xnam,ynam)
but that syntax is not valid for the case where Y is [] as it is in your call. Your Y is empty: you are plotting X against itself
In any case, xnam and ynam parameters label according to columns of variables, whereas you want to label according to row values.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by