필터 지우기
필터 지우기

Image plot with quiver vector overlain

조회 수: 1 (최근 30일)
Brent Majcher
Brent Majcher 2022년 2월 26일
댓글: Brent Majcher 2022년 2월 26일
Hi,
I am trying to plot a quiver vectors on top of an image (png file).
So far, I have been able to plot the image. However, I am having the following problems....
  1. The y axis is inverted, and I have no idea how to inverse the image
  2. The quiver plot does not show up on top of the image
Can anyone help direct me to some resources on this or help with my code? I would be forever greatful.
Cheers
set(gca,'YDir','normal')
I = imread('GH2017.png');
RI = imref2d(size(I));
RI.XWorldLimits = [335300 336189];
RI.YWorldLimits = [5934952 5935582];
imshow(I,RI)
hold on
quiver(X(:,2),X(:,1),D(:,2),D(:,1));
ylabel('Northing')
xlabel('Easting')
Notes:
  • The quiver plot works with data in X and D matrices, however does not plot on top of the image
  • On a graph, the top left coordinate should be 5935582 and 335300 and the bottom right coordinate should be 5934952 and 336189. Cheers

답변 (1개)

Scott MacKenzie
Scott MacKenzie 2022년 2월 26일
편집: Scott MacKenzie 2022년 2월 26일
quiver is drawing on top of the image. You haven't provided any data or code that can be executed, so it's hard to tell what the problem is. My hunch is that the quiver lines are being drawn off the image. Try swapping the x and y values in quiver:
quiver(X(:,1),X(:,2),D(:,1),D(:,2));
If that doesn't work, please post the data for X and D and we'll dig a little deeper.
  댓글 수: 1
Brent Majcher
Brent Majcher 2022년 2월 26일
You're a beauty. I had survey data in different coordinate system than the image and therefore it was outside of the plot extents. Thanks for the comment, pointed out where I might be wrong.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by