Plotting around zero deg. Angle

I'm plotting an image using: Imagsc(x,y,C) where x is an angle vector from 280 deg to 50 deg trough 0 deg. I Want to see the image with zero at the center. Instead i have the data from 50 to 280. How to overcome this? The image looks like two halfs apart???

回答 (3 件)

Image Analyst
Image Analyst 2025 年 2 月 17 日

0 投票

I think you have to convert to rectangular/cartesian coordinates. pol2cart might help. You can use XData and YData in imshow if you want the axes tick marks to be in a certain range, like with zero at the center.

1 件のコメント

mrish
mrish 2025 年 2 月 17 日

Pol2cart is not relevant. The axes should be angles and not cos/sin of them.

Imshow works similar to imagesc. The plot data will be from 50-280 and not the complemanry of that

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

Star Strider
Star Strider 2025 年 2 月 17 日

0 投票

Aside from not having any image to work with, I am not certain what you want.
First use plot to see what the problem may be.
Try this —
a = [280 0 50];
x = cosd(a);
y = sind(a);
figure
plot([x; zeros(size(x))], [y; zeros(size(y))])
axis('equal')
How do you intend to plot that as an image?
If this is not what you want, what about it needs to change?
.

3 件のコメント

mrish
mrish 2025 年 2 月 17 日

Its not what i want.

Lets say x is an azimuth angle vector of 250 260,..., 360/0 ... 10 , 20 30.

And same values for y - an elevation angles vector.

I have a matrix with data value to match each az and elevation direction. And i want to show that data as a function of azimuth and elevation.

The default imagesc plot from 30, trough 180 to 250, because the angle are offset to zero after 360.

I want to plot the opposite direction from 250 to 0 to 30.

Star Strider
Star Strider 2025 年 2 月 17 日
I am still not certain what your data are, or what you want to plot.
If theey can be plotted iin 3D in some respect, as a scatter plot (scatter3) or a surface (surf), the view function can select the azimuth and elevation for the camera position to view it.
.
Walter Roberson
Walter Roberson 2025 年 2 月 17 日
If the marginal x vector is [280...359, 0..50] then scatter3 will drawn the data in two sections, one from 0 to 50 and the other from 280 to 359. surf() and pcolor() will draw the data from 0 to 50 and then interpolate a large cell from 50 to 280, and then draw 280 to 359.
There are always options such as putting two adjacent axes side by side, one from 280 to 360 and the other from 0 to 50

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

Walter Roberson
Walter Roberson 2025 年 2 月 17 日

0 投票

When you specify a vector for x for imagesc, MATLAB ignores everything except for the first and last entries. It does not care that your vector rises from 280 through 359 and then starts from 0 up to 50: it treats it as 280 down to 50 (with no zero passed through)
What you can do is set the x component to be -80 to 50, and then use xlabel() to change the labeling to [280 to 359, 0 to 50].
You might want to accompany that with a datacursormode configuration that has a function that adjusts the displayed x coordinate
mask = x < 0;
adjustx = x;
adjustx(mask) = 360+adjustx(mask);

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

質問済み:

2025 年 2 月 17 日

コメント済み:

2025 年 2 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by