How to avoid overlapping of text labels in plot?

조회 수: 81 (최근 30일)
Sheila Dangol
Sheila Dangol 2019년 9월 20일
댓글: Sheila Dangol 2019년 9월 27일
The data in the graph(shown below) have same value and the labelling is unclear here due to overlapping. Is there any way to avoid overlapping of the labels?
Thank you!
Matlab.PNG
  댓글 수: 3
Sheila Dangol
Sheila Dangol 2019년 9월 20일
Hey! Thanks for the reply. But how can I label these data using annotation? I tried using the following syntax but it doesn't work. Could you please help me on this?
labels={'Qinf','TSin','RS','SVISC3','TSminSC3','saSC3','sbSC3','n2SC3','V0SC3','ASC3S','hSC3S'};
annotation('textarrow',x,y, labels);
Walter Roberson
Walter Roberson 2019년 9월 22일
You would use a different annotation('textarrow') call for each point.

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

답변 (1개)

Harsha Priya Daggubati
Harsha Priya Daggubati 2019년 9월 23일
Hi,
As Walter Roberson mentioned, you need to create annotation for every point that needs to be plotted, in your case for 11 (x,y) points.
  댓글 수: 1
Sheila Dangol
Sheila Dangol 2019년 9월 27일
This is my code. My text function is inside the loop. How could I customize the 'annotation' function for this code. Any suggestion, please?
filename='Sensitivity_indices.xlsx';
X = readmatrix(filename,'Sheet','M3');
labels={'Qinf','TSin','R','SVI','TSmin','sa','sb','n2','V0','A','h'};
T={'TSS conc.','Sludge conc.','TSS load','Sludge load'};
k=1;
figure('Name','Model 3: SiVsPed')
for i=[2 4 6 8] %No. of columns selected
if k>4
end
subplot(2,2,k)
scatter(X(:,10),X(:,i),'filled');
xlim([0 1]);
set ( gca, 'xdir', 'reverse' )
text(X(:,10),X(:,i),labels,'VerticalAlignment','top','HorizontalAlignment','right');
ylim([0 1]);
title(sprintf('Model 2: %s', T{k}));
xlabel('Strength');
ylabel('Sensitivity(Si)');
k=k+1;
end

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

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by