Scatter plot does not display multiplied values
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
לק"י
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1441808/image.png)
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1441813/image.png)
Please, if anyone know what am I doing wrong please let me know.
Thanks,
Amit.
0 commentaires
Réponses (1)
VBBV
le 25 Juil 2023
Modifié(e) : VBBV
le 25 Juil 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')
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!