Hi,i'm fairly new to all this, but as the title say i need help to make a point plot from my data. So i have a [M N] Matrix (my test data is 7x15, but it need to work with any size matrix),
i want to have so it look like this.: https://www.google.dk/search?q=scatterplot&source=lnms&tbm=isch&sa=X&ved=0ahUKEwj27tGe7vDaAhXTxKYKHabqBAsQ_AUICigB&biw=1366&bih=637#imgrc=hjPIB_OYmEMk7M: but i can't make it work with a unknown size matrix. I have tried with the in-build scatterplot function (isn't it the best function to use in this case) I have also tried with gplotmatrix but it's a bit more complex..
Thank you in advance, sincerely
Christian

댓글 수: 4

Ameer Hamza
Ameer Hamza 2018년 5월 6일
This is just one variable. For scatter, you will need two variables. How do you decide the location of each point from this matrix.
Christian Jensen
Christian Jensen 2018년 5월 6일
편집: per isakson 2018년 5월 6일
I were thinking that the x value would be equal the column value if that make any sense. an example: if I had the matrix
[1,1,1;2,2,2;3,3,3]
then the coordinates I would have to plot would be
for column 1: (1,1), (1,2) & (1,3)
for column 2: (2,1), (2,2) & (2,3)
for column 3: (3,1), (3,2) & (3,3)
Ameer Hamza
Ameer Hamza 2018년 5월 6일
Do you mean column value or row value? Look at my answer below. It takes column number as x value.
Christian Jensen
Christian Jensen 2018년 5월 6일
column value, going to try it out, thanks !

댓글을 달려면 로그인하십시오.

 채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 6일

1 개 추천

As you mentioned in the comment, you can do it as follow
xData = ones(size(data)).*[1:size(data,2)]; % create x matrix with same column number
scatter(xData(:), data(:));
here data is the name of your m*n matrix.

댓글 수: 2

Christian Jensen
Christian Jensen 2018년 5월 6일
YES! it worked been trying for almost two days to make it work, thanks :-D
Ameer Hamza
Ameer Hamza 2018년 5월 6일
Happy that it helped. You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

질문:

2018년 5월 6일

댓글:

2018년 5월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by