Rotating a line plot to obtain a 360-degree color map
19 views (last 30 days)
Show older comments
I would like to rotate the line plot on the left about its central point to create a 360 degree color map, that looks somewhat like to the image on the right. Any suggestion on how to rotate and extrapolate the data?
0 Comments
Answers (1)
Star Strider
on 12 Jul 2024 at 20:47
Itt would help to have the data.
It also appears that the line is not the same everywhere (it may be part of a matrix), although only one line (most likely row) is shown.
One ap;proach is tot create a matrix from it as a function of an angle, and then use the pol2cart function to transform it into Cartesian coordinates —
Nr = 250;
th = linspace(0, 2*pi, Nr);
Nc = 50;
rv = linspace(0, 3.5*pi, Nc);
r = cos(rv) + 1;
figure
plot(rv, r)
[T,R] = ndgrid(th, rv);
A = repmat(r, Nr, 1);
figure
surf(T, R, A, 'EdgeColor','none')
colormap(turbo)
colorbar
[X,Y,Z] = pol2cart(T, R, A);
figure
surf(X, Y, Z, 'EdgeColor','interp')
colormap(turbo)
colorbar
figure
surf(X, Y, Z, 'EdgeColor','interp')
colormap(turbo)
colorbar
axis('equal')
view(0,90)
figure
contourf(X, Y, Z, 'LineColor','none')
colormap(turbo)
colorbar
axis('equal')
This is my best guess.
0 Comments
See Also
Categories
Find more on Purple in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!