How to plot circle with text aligned along its circumference

조회 수: 5 (최근 30일)
Jayant chouragade
Jayant chouragade 2021년 8월 20일
답변: Thorsten 2025년 4월 11일
Hi,
How to plot a circle at X=0, Y=0 and radius=10, and inculde its radius as text in its circumference.
best
regards
jayant

답변 (2개)

Thorsten
Thorsten 2025년 4월 11일
If your goal is to plot the text along the circle, you can use this code. Adopt the starting angle (135) and the angular offset (5) to your needs.
centerY = 0;
Radius = 10;
viscircles([centerX ,centerY ], Radius );
word = 'my circled text';
i = 1;
for alpha = 135:-5:135-(numel(word)-1)*5
text(10*cosd(alpha), 10*sind(alpha), word(i), 'Rotation', alpha-90, 'FontSize', 20);
i = i+ 1;
end

Awais Saeed
Awais Saeed 2021년 8월 20일
centerX = 0;
centerY = 0;
Radius = 10;
viscircles([centerX ,centerY ], Radius ); % it creates a circle with given parameters
text(centerX, Radius,'R = 10') % to add text to your plot
  댓글 수: 1
Awais Saeed
Awais Saeed 2021년 8월 20일
You would have to chage the axes if you want to change position of your text.
xlim([-Radius-3 Radius+3])
ylim([-Radius-3 Radius+3])
text(centerX, Radius+1,'R = 10') % Note it will display text at Y = 11

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

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by