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

1 Ansicht (letzte 30 Tage)
Ignacio Alcala
Ignacio Alcala am 10 Nov. 2023
Beantwortet: Image Analyst am 10 Nov. 2023

Antworten (2)

Star Strider
Star Strider am 10 Nov. 2023
Bearbeitet: Star Strider am 10 Nov. 2023
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 am 10 Nov. 2023
See my attached colorwheel demo. You can vary things like inner and outer radius, number of colors, etc.

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by