2D color dotted plot with three vectors

1 Ansicht (letzte 30 Tage)
Yannick Tabot Njami
Yannick Tabot Njami am 26 Mär. 2019
Hello,
I would like to create a 2D color plot of 3 vectors where X Y and Z is to be color doted for each corresponding pairs of (x,y)
here is my code :
i get the error index exceed matrix dimension . here is an abstract of my data
x = 20 50 80 110 140 170 200 230
y= 20 20 20 20 20 20 20 20
meanv= 58.0194 57.9150 57.7572 57.5733 57.7197 57.7133 58.0707 58.1603
%% Generating the 2D color plot
figure(2)
for N=1:size(plotData,2)
plotData{1,N}.data();
x=plotData{1,N}.data(:,1);
y=20:30:230;
data2plot=plotData{1,N}.data(:,3:end);
pointsize =10;
for i =3:6
scatter(x,y,pointsize,data2plot(:,i))
end
end
  1 Kommentar
KSSV
KSSV am 26 Mär. 2019
What for x,y,meanv is given? YOur question is not clear. With what data in hand you want to generate a plot as attached?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Yannick Tabot Njami
Yannick Tabot Njami am 26 Mär. 2019
Hello KSSV;here is my data .
plotData{1}
ans =
struct with fields:
y: 20
data: [8×6 double]
and in data i have :
plotData{1}.data()
ans =
1.0e+03 *
0.0200 0.0200 0.0580 0.0002 2.0198 0.0141
0.0500 0.0200 0.0579 0.0002 2.0125 0.0146
0.0800 0.0200 0.0578 0.0002 2.0016 0.0153
0.1100 0.0200 0.0576 0.0002 1.9888 0.0171
0.1400 0.0200 0.0577 0.0002 1.9990 0.0160
0.1700 0.0200 0.0577 0.0003 1.9985 0.0200
0.2000 0.0200 0.0581 0.0002 2.0234 0.0164
0.2300 0.0200 0.0582 0.0002 2.0296 0.0148
>> where x =plotData{1}.data(:,1)
y =plotData{1}.data(:,2)
and the the last three colums i want to plot as as the color.
the size of my complete data is a 1 by 8 cell of struct.
thanks
  1 Kommentar
KSSV
KSSV am 27 Mär. 2019
The data is not clear......any ways...I assume your problem got solved....

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Yannick Tabot Njami
Yannick Tabot Njami am 27 Mär. 2019
hello KSSV
i have not solve the problem till now . here is my data attached
first column is the x coordinate,
second column is the y coordinate
each x(i) and y(i) has a z(i) where z is the last fouth columns.
z(i) represent the color to be coded at piont (x(i),y(i)).
my complete data is 1 by 8 cell . attached you will find the first cell data.
data2.png

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by