3D Plot of a Matrix with only Char data type

1 Ansicht (letzte 30 Tage)
Cutie
Cutie am 5 Okt. 2021
Bearbeitet: Cutie am 5 Okt. 2021
  1. I have a matrix which with Char data type i.e All data are in text format.
  2. My goal is to make an x-y-z plot that will rep these data in an image format
  3. Can this be done in Matlab
  4. Data sample below
x= 'USA', 'Germany', 'South Africa', 'China', 'Mexico', 'Australia'
y = 'America', 'Europe', 'Africa', 'Asia', 'South America', 'Australia'
z= 'First world', 'Tech', 'Developing', 'Business', 'Work force', 'Medicine'
  3 Kommentare
the cyclist
the cyclist am 5 Okt. 2021
@Cutie, perhaps take a look at the MATLAB Gallery, and think about which type of plot might be able to translate your type of data into a visualization.
Cutie
Cutie am 5 Okt. 2021
Bearbeitet: Cutie am 5 Okt. 2021
Thank you @Walter Roberson.
Kindly see output from the code below:
x= {'USA', 'Germany', 'South Africa', 'China', 'Mexico', 'Australia'};
y = {'America', 'Europe', 'Africa', 'Asia', 'South America', 'Australia'};
z= {'First world', 'Tech', 'Developing', 'Business', 'Work force', 'Medicine'};
figure
zz = ones(6,6);
zz= 7*zz;
bar3(zz)
xticklabels(x)
yticklabels(y)
zticklabels(z)
The idea is to show how x (countries), y (continent) and z (related/shared characteristics) are integrated in a matrix-like manner. We want to see inter-relationship among them.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Chunru
Chunru am 5 Okt. 2021
x= {'USA', 'Germany', 'South Africa', 'China', 'Mexico', 'Australia'};
y = {'America', 'Europe', 'Africa', 'Asia', 'South America', 'Australia'};
z= {'First world', 'Tech', 'Developing', 'Business', 'Work force', 'Medicine'};
% convert string to categorical (numerical)
xc = categorical(x);
yc = categorical(y);
zc = categorical(z);
% plot the result, eg. stem3
figure
stem3(xc, yc, zc)
  1 Kommentar
Cutie
Cutie am 5 Okt. 2021
Bearbeitet: Cutie am 5 Okt. 2021
@Chunru, thank you so much
  1. but how do I show the interconnection between?
  2. and how do I convert the final output represent back to the original string/char?
  3. Can the output all be of the same hieght? since the aim is to show inter-relationship between them.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by