![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177502/image.jpeg)
Plotting a single data line over a 2D image
6 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a base 2D image that represents some data on a map. I would like to pick a line along this image, and plot the corresponding quantities ABOVE the base image (so it would appear like in a 3D visualization). I feel like this is different from using plot3 and adding a base image at its bottom with imagesc. Also different from taking a slice from a 3D volume. Is there a strategy for this?
0 件のコメント
回答 (1 件)
Yu-Tung Lin
2017 年 7 月 19 日
I assume you have the base image and the line data prepared. To plot a line above the image, I suggest to do the following.
Here, I used the same data for the base map and the line above for example. See following code:
%%base image
[X,Y,Z] = peaks;
figure
contour(X,Y,Z,20)
%%add line above
line(X,Y,Z+15) %add height to Z
view(3) % change the position of the viewer
This code will give you
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177502/image.jpeg)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!