How can I fill the inside circle with any color?

2 ビュー (過去 30 日間)
Shreen El-Sapa
Shreen El-Sapa 2023 年 12 月 17 日
コメント済み: Star Strider 2023 年 12 月 17 日
too long code

回答 (1 件)

Star Strider
Star Strider 2023 年 12 月 17 日
Try something like this —
imshow(imread('st1.jpg'))
a = linspace(0, 2*pi, 500).';
r = [1 2];
x = r.*cos(a);
y = r.*sin(a);
figure
hp1 = plot(x, y);
hold on
patch(hp1(1).XData, hp1(1).YData, [0.1 0.5 0.9])
hold off
axis('equal')
You will need to choose the correct (x,y) data for the inner circle. Then use the patch function to fill it.
.
  6 件のコメント
Shreen El-Sapa
Shreen El-Sapa 2023 年 12 月 17 日
thanks
Star Strider
Star Strider 2023 年 12 月 17 日
My pleasure!
The entire code may be too long, however saving the data that created that plot to a .mat file, and posting the code that plotted it from those data might be enough.
A less favorable option for me would be to upload the .jpg image as a .fig file instead. I may be able to work with it in that context, since I might be able to get the data from it. Some plots are relatively straightforward to work with and others can be incredibly difficult.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by