Plotting surf tiles at the center rather than bottom left
조회 수: 6 (최근 30일)
이전 댓글 표시
As per the title, is there a way to do this?
if true
surf(double(B));
view(2);
hold on
plot3(x_P,y_P,2*ones(1,particles),'ws')
drawnow
hold off
axis tight
axis square
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148635/image.jpeg)
I want the red squares in the center of the coordinates, not at the bottom-left, as I'm trying to implement a particle filter and want to display the results best visually.
댓글 수: 0
답변 (1개)
Kevin Claytor
2012년 9월 4일
It looks like you're using essentially a binary map for the image. I would use imagesc instead, it draws the patch centered at the (x,y) coordinates. Surf draws the patch between the (x,y) coordinates. Example;
[X,Y,Z] = peaks(30);
figure; hold on;
imagesc(X(1,:),Y(:,1),Z);
plot(X,Y,'ws');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!