Shift figure to specific Z axis location

4 ビュー (過去 30 日間)
mackhina
mackhina 2019 年 12 月 22 日
コメント済み: mackhina 2019 年 12 月 26 日
I am trying to plot a scatterplot against a topographical figure. When I opent the figure is currently set to the z-axis at 0. When I load the figure, is there a way to set it at a specific z-azis (e.g. -45 for my case). This way the scatter3 plot (which is plotted against depth) will show above the image.
for l = 1:(length(indx1))
data2 = table2array(data1{1,l});
for m = 1:length(indx2)
fig_name = string(sheets(indx1(1))) + ': Value - ' + string(table_name(m)); % Figure name
openfig('topo_image.fig'); % Open map figure to plot data against
set(gcf,'name', fig_name);
hold on
scatter3(data2(:,3),data2(:,4),data2(:,7),40,data2(:,8))
end
end
z-axis.PNG
Thanks for any help!

採用された回答

Walter Roberson
Walter Roberson 2019 年 12 月 22 日
No, figures do not have Z coordinates, only items within axes can have Z coordinates.
If you can findobj() the map within the figure then you can alter its ZData, if it has ZData. If it does not have ZData (for example image() do not have ZData) then you can create an hgtransform() and parent the object to it, and set a transform matrix for the hgtransform object.
  1 件のコメント
mackhina
mackhina 2019 年 12 月 26 日
Thanks for the advice. I wasn't able to get hgtransfrom working (examples where a bit confusing with my limited matlab knowledge), but warp worked on the image in the way you mentioned, and I was then able to save it as the figure for my scatter3 plot. Cheers!
im = imread('topo_image.png');
figure
[X,Y] = meshgrid(1:size(im,2),1:size(im,1));
warp(X,Y,-45*ones(size(X)),im)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by