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.

 채택된 답변

Voss
Voss 2023년 8월 2일

0 개 추천

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')

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

RP
2023년 8월 2일

답변:

2023년 8월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by