Change x,y,z axes position in a 3d plot - subplot issue

2 ビュー (過去 30 日間)
Alberto Scarampi del Cairo
Alberto Scarampi del Cairo 2019 年 3 月 25 日
Hello. I would like to change the positions of the label of a 3d plot to the back of the graph. I am using the XRuler property as jonas suggested in previous question (https://it.mathworks.com/matlabcentral/answers/420731-moving-the-labels-of-the-z-axis-to-the-back-of-the-3d-graph). When I plot one graph everythng works fine, hoever when I try to make subplots, one big plot overwrites all the others (as in the figure attached).
Here is the code I am using:
params = struct;
params.supply = zeros(1,3,9); %3D matrix with the data to plot
params.supply(1,:,1) = [0.8 0.1 0.1];
params.supply(1,:,2) = [0.7 0.1 0.2];
params.supply(1,:,3) = [0.475 0.05 0.475];
params.supply(1,:,4) = [0.4 0.4 0.2];
params.supply(1,:,5) = [0.3 0.3 0.4];
params.supply(1,:,6) = [0.2 0.2 0.6];
params.supply(1,:,7) = [0.1 0.8 0.1];
params.supply(1,:,8) = [0.1 0.7 0.2];
params.supply(1,:,9) = [0.05 0.475 0.475];
figure(1);hold on
for deme= 1:9
subplot(3,3,deme)
hAxis = axes;
scatter3(params.supply(1,1,deme), params.supply(1,2,deme), params.supply(1,3,deme),'d')
hAxis.XAxis.FirstCrossoverValue = hAxis.XLim(2);
hAxis.XAxis.SecondCrossoverValue = hAxis.XLim(1);
hAxis.YAxis.FirstCrossoverValue = hAxis.XLim(2);
hAxis.YAxis.SecondCrossoverValue = hAxis.XLim(1);
hAxis.ZAxis.FirstCrossoverValue = hAxis.XLim(2);
hAxis.ZAxis.SecondCrossoverValue = hAxis.XLim(2);
hAxis.XLim = [0 1];
hAxis.YLim = [0 1];
hAxis.ZLim =[0 1];
end
hold off
fig1.png
I feel like I am doing a stupid error somewhere, but can't seem to find it. Any ideas ?

採用された回答

Steven Lord
Steven Lord 2019 年 3 月 25 日
for deme= 1:9
subplot(3,3,deme)
hAxis = axes;
You're creating a subplot axes, then immediately creating an axes in the default position (which likely covers part or all of your subplot axes.) Instead, just get the handle to the subplot axes when you create it.
for deme= 1:9
hAxis =subplot(3,3,deme)
Now when you manipulate the axes whose handle is stored in hAxis, you're manipulating the axes you created using subplot.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by