How to draw a semi circle filled with jet color (like in the image) ?

2 ビュー (過去 30 日間)
Ignacio Alcala
Ignacio Alcala 2023 年 11 月 10 日
回答済み: Image Analyst 2023 年 11 月 10 日

回答 (2 件)

Star Strider
Star Strider 2023 年 11 月 10 日
編集済み: Star Strider 2023 年 11 月 10 日
Try this —
N = 250;
th1 = linspace(pi, 3*pi/2, N);
r = linspace(0, 1, N);
z = r;
x1 = r(:)*cos(th1);
y1 = r(:)*sin(th1);
z1 = r(:)*ones(1,N);
figure
surf(x1,y1,z1, 'EdgeColor','none')
axis('equal')
colormap(jet(N))
view(0,90)
xtxt = linspace(min(xlim), max(xlim), 4);
text(xtxt, ones(1,4)*max(ylim), compose('$%2d^{\\circ}$',[15 10 5 0]), 'Vert','bottom', 'Horiz','right', 'FontSize',15, 'Interpreter','latex')
Ax = gca;
Ax.Visible = 'off';
N = 250;
th2 = linspace(pi/2, 3*pi/2, N);
r = linspace(0, 1, N);
z = r;
x2 = r(:)*cos(th2);
y2 = r(:)*sin(th2);
z2 = r(:)*ones(1,N);
figure
surf(x2,y2,z2.', 'EdgeColor','none')
axis('equal')
colormap(jet(N))
view(0,90)
axis('padded')
Ax = gca;
Ax.Visible = 'off';
text(1.2*cos([3 2 1]*pi/2), 1.2*sin([3 2 1]*pi/2), [1 1 1], {'$\frac{3\pi}{2}$', '$\pi$', '$\frac{\pi}{2}$'}, 'Interpreter','latex', 'FontSize',26, 'Horiz','right', 'Vert','middle')
Make appropriate changes to get the desired result.
EDIT — Corrected typographical errors.
.

Image Analyst
Image Analyst 2023 年 11 月 10 日
See my attached colorwheel demo. You can vary things like inner and outer radius, number of colors, etc.

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by