Creating 2d scatter plot with different dot size and color accoridng to vlaues in matrices
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have two matrices, one is say 5x5 double with magnitude and the other is 5x5 of direction. The 'y-axis' or values along the column represent a length while the values along the row represent years.
Matrix1 =
1 3 4 5 8
2 7 3 9 1
2 4 5 4 3
7 1 9 8 6
Matrix2 =
-0.1 -0.93 0.4 0.65 0
.25 .71 .83 -.59 -0.7
.23 -.14 -.55 .49 .53
74. .71 -.19 .58 -.76
Row(x-axis) =
2000 2001 2002 2003 2004
Column(y-axis) =
50
40
30
20
10
I want to create a scatter plot with x and y axis as above with matrix1 giving size of the dot (say everything smaller than 5 as one size and larger than 5 as another) and Matrix2 giving the color (say negative sign as red, positive as blue, yellow otherwise).
I am having a hard time implementing this with scatter plot. It is not a 3d plot, basically it says that in 2000, the 50th member had magnitude of 1 and negative direction.
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 4 Apr 2016
M1=[1 3 4 5 8
2 7 3 9 1
2 4 5 4 3
7 1 9 8 6]
M2=[-0.1 -0.93 0.4 0.65 0
.25 .71 .83 -.59 -0.7
.23 -.14 -.55 .49 .53
74. .71 -.19 .58 -.76]
R1=[2000 2001 2002 2003 2004]
C1=[50 40 30 20 10 ]
[ii,jj]=meshgrid(R1,C1)
cl=sign(M2)+2
col='byr'
for k=1:numel(M1)
h=scatter(ii(k),jj(k),'MarkerFaceColor',col(cl(k)),'linewidth',M1(k))
hold on
end
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!