Borrar filtros
Borrar filtros

adding text to scatter plot

39 visualizaciones (últimos 30 días)
Prasad Joshi
Prasad Joshi el 10 de Feb. de 2022
Comentada: Prasad Joshi el 10 de Feb. de 2022
The code I develop .. can I add one more sub text so as to differentiate the cases ...For eg :- after 7378 there should be one more text for [ 55 55] duration is there any possibility to add second text in the plot ...can second text be added to the corresponding value ...any inputs thank you in advance
A=xlsread('Compare_All_cases','B9:AB9');
x1=ones(1,3);
y1=A(:,(1:3))
scatter(x1,y1,'filled','r')
xticks([1])
xticklabels({'2 kW'})
text(x1(1),y1(1),sprintf('(%.0f)',y1(1)))
text(x1(2),y1(2),sprintf('(%.0f)',y1(2)))
text(x1(3),y1(3),sprintf('(%.0f)',y1(3)))
hold on
x2=ones(1,3);
y2=A(:,(4:6))
scatter(x2,y2,'filled','b')
xticks([1])
xticklabels({'2 kW'})
text(x2(1),y2(1),sprintf('(%.0f)',y2(1)))
text(x2(2),y2(2),sprintf('(%.0f)',y2(2)))
text(x2(3),y2(3),sprintf('(%.0f)',y2(3)))
legend('20 sec','35 sec')
can we add like this ...One more text..any changes in code can some suggest
  2 comentarios
AndresVar
AndresVar el 10 de Feb. de 2022
yes you can replace replace the formatting string with '(%.0f) [blah blah]'.
Although I like the different colors with a legend better.
Prasad Joshi
Prasad Joshi el 10 de Feb. de 2022
Thank you Andres

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 10 de Feb. de 2022
You may write:
str = strcat('7427 [35 35]') ;
And then use text.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by