Scatter plot does not display multiplied values

1 view (last 30 days)
לק"י
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.

Answers (1)

VBBV
VBBV on 25 Jul 2023
Edited: VBBV on 25 Jul 2023
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 Comment
Amit Ifrach
Amit Ifrach on 25 Jul 2023
לק"י
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!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!