Scatter plot does not display multiplied values

조회 수: 1 (최근 30일)
Amit Ifrach
Amit Ifrach 2023년 7월 25일
댓글: Amit Ifrach 2023년 7월 25일
לק"י
Hello!
I want to scatter plot some data (two vectors and two numbers). when I scatter them the plot is correct.
If I add multiplication by a constant, the vectors are scattered well with the new values, but the numbers are not, and I can't figure out why. I tried to put them in brackets, but it didnt help. and when I calculate the values they are correct. only the display is not updated (I close the figure after the code update).
The origianl code:
figure (2)
scatter(acd3sctrdata(1:end,1), acd3sctrdata(1:end,3), 'blue', 'filled')
hold on
scatter(acd45sctrdata(1:end,1), acd45sctrdata(1:end,3), 'red', 'filled')
scatter(3.5, [acd3means{10,2}], 10, 'blue', "filled")
e3=errorbar(3.5, [acd3means{10,2}],[acd3means{10,3}], 'x')
e3.Color= 'black';
scatter(1.5, [acd45means{10,2}], 10, 'red', "filled")
e45=errorbar(1.5, [acd45means{10,2}],[acd45means{10,3}], 'x')
e45.Color= 'black';
hold off
title('CD8+ CAR-T cells area of pixels > 1.5, upon aCD45(r) and aCD3(b)')
xlabel('aCD45 aCD3')
ylabel('Area of pixels > avg*1.5, um^2')
legend({'Blue = aCD3', 'Red = aCD45'},'Location','northwest')
The plot it generates:
The code with *1.66 multiplication added:
figure (2)
scatter(acd3sctrdata(1:end,1), acd3sctrdata(1:end,3)*0.166, 'blue', 'filled')
hold on
scatter(acd45sctrdata(1:end,1), acd45sctrdata(1:end,3)*0.166, 'red', 'filled')
scatter(3.5, [acd3means{10,2}]*0.166, 10, 'blue', "filled")
e3=errorbar(3.5, [acd3means{10,2}],[acd3means{10,3}]*0.166, 'x')
e3.Color= 'black';
scatter(1.5, [acd45means{10,2}]*0.166, 10, 'red', "filled")
e45=errorbar(1.5, [acd45means{10,2}],[acd45means{10,3}]*0.166, 'x')
e45.Color= 'black';
hold off
title('CD8+ CAR-T cells area of pixels > 1.5, upon aCD45(r) and aCD3(b)')
xlabel('aCD45 aCD3')
ylabel('Area of pixels > avg*1.5, um^2')
legend({'Blue = aCD3', 'Red = aCD45'},'Location','northwest')
The plot it generates, where the [acd3means{10,2}]*0.166 and [acd45means{10,2}]*0.166 are not displayed/updated well:
Please, if anyone know what am I doing wrong please let me know.
Thanks,
Amit.

답변 (1개)

VBBV
VBBV 2023년 7월 25일
편집: VBBV 2023년 7월 25일
If I add multiplication by a constant, the vectors are scattered well with the new values, but the numbers are not
This is something strange, May be you have to change the figure number to see the actual difference in numbers and/or values in separate figures. It seems you are using same figure number and perhaps inside a loop when viewing the outputs which can be confusing sometimes. According to your screenshots the numbers seemed to be plotted or displayed well after scaling with number 0.166. Do you actually want to use 1.66 instead ?
figure (1)
scatter(acd3sctrdata(1:end,1), acd3sctrdata(1:end,3), 'blue', 'filled')
hold on
scatter(acd45sctrdata(1:end,1), acd45sctrdata(1:end,3), 'red', 'filled')
scatter(3.5, [acd3means{10,2}], 10, 'blue', "filled")
e3=errorbar(3.5, [acd3means{10,2}],[acd3means{10,3}], 'x')
e3.Color= 'black';
scatter(1.5, [acd45means{10,2}], 10, 'red', "filled")
e45=errorbar(1.5, [acd45means{10,2}],[acd45means{10,3}], 'x')
e45.Color= 'black';
hold off
title('CD8+ CAR-T cells area of pixels > 1.5, upon aCD45(r) and aCD3(b)')
xlabel('aCD45 aCD3')
ylabel('Area of pixels > avg*1.5, um^2')
legend({'Blue = aCD3', 'Red = aCD45'},'Location','northwest')
figure (2) %// change the figure number
scatter(acd3sctrdata(1:end,1), acd3sctrdata(1:end,3)*0.166, 'blue', 'filled')
hold on
scatter(acd45sctrdata(1:end,1), acd45sctrdata(1:end,3)*0.166, 'red', 'filled')
scatter(3.5, [acd3means{10,2}]*0.166, 10, 'blue', "filled")
e3=errorbar(3.5, [acd3means{10,2}],[acd3means{10,3}]*0.166, 'x')
e3.Color= 'black';
scatter(1.5, [acd45means{10,2}]*0.166, 10, 'red', "filled")
e45=errorbar(1.5, [acd45means{10,2}],[acd45means{10,3}]*0.166, 'x')
e45.Color= 'black';
hold off
title('CD8+ CAR-T cells area of pixels > 1.5, upon aCD45(r) and aCD3(b)')
xlabel('aCD45 aCD3')
ylabel('Area of pixels > avg*1.5, um^2')
legend({'Blue = aCD3', 'Red = aCD45'},'Location','northwest')
  댓글 수: 1
Amit Ifrach
Amit Ifrach 2023년 7월 25일
לק"י
Hi VBBV
I dound the problem. I tried to change to the actual calculated numbers, insted of the [acd3means{10,2}]*0.166 and [acd45means{10,2}]*0.166. and still it didn't work. I read the code again and found I had to multiply also in the e4 and e45 lines like that:
e3=errorbar(3.5, [acd3means{10,2}]*0.166,[acd3means{10,3}]*0.166, 'x')
e45=errorbar(1.5, [acd45means{10,2}]*0.166,[acd45means{10,3}]*0.166, 'x')
The previous code didn't have the multiplication in the y axis, thus the error bars stayed in their old position. this is the old code:
e3=errorbar(3.5, [acd3means{10,2}],[acd3means{10,3}]*0.166, 'x')
e45=errorbar(1.5, [acd45means{10,2}],[acd45means{10,3}]*0.166, 'x')
Thanks and sorry!

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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by