Effacer les filtres
Effacer les filtres

scatterplot for matrix output

1 vue (au cours des 30 derniers jours)
RP
RP le 2 Août 2023
Réponse apportée : Voss le 2 Août 2023
I would like to display the output of a matrix (40 *46) in a scatter plot. The ouptut is standardised resiudals from -1 to 1. The x axis is age (50 to 95) and the y axis is year (1980 to 2019). Postive residuals are green and negative residuals are red.

Réponse acceptée

Voss
Voss le 2 Août 2023
M = 2*rand(40,46)-1; % random residuals -1 to 1
ages = 50:95;
years = 1980:2019;
[A,Y] = meshgrid(ages,years);
idx = M > 0;
scatter(A(idx),Y(idx),[],[0 1 0],'filled') % green
hold on
scatter(A(~idx),Y(~idx),[],[1 0 0],'filled') % red
xlabel('Age')
ylabel('Year')

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by