![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/718109/image.png)
highlight plot with circle
1 次查看(过去 30 天)
显示 更早的评论
I have a ber plot and I want to highlight this plot with a circle or any eliptical shape indicating (M×N).
2 个评论
采纳的回答
Awais Saeed
2021-8-22
I do not know if its possible programmatically but you can acheive this using the Insert option of figure window![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/718119/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/718119/image.png)
更多回答(1 个)
Image Analyst
2021-8-22
You can draw an ellipse if you know the center and radii:
xCenter = 12.5;
yCenter = 10;
xRadius = 2.5;
yRadius = 8;
theta = 0 : 0.01 : 2*pi;
x = xRadius * cos(theta) + xCenter;
y = yRadius * sin(theta) + yCenter;
plot(x, y, 'LineWidth', 3);
axis square;
xlim([0 20]);
ylim([0 20]);
grid on;
If you have an existing plot, call hold on before plotting the ellipse so it doesn't blow away your prior plotted data.
2 个评论
Image Analyst
2021-8-23
@mudasir ahmad sheikh, you're welcome. Also I'm attaching a bunch of ellipse demos that you may find fun or interesting. You can "Vote" for my answer if they help you.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!