【问题标题】:Multiple axes for a single surf plot单个冲浪图的多个轴
【发布时间】:2016-03-16 13:47:28
【问题描述】:

我有一个冲浪图,我想在其中有两个 y 轴。我似乎找不到任何其他类似这样的讨论。

到目前为止我得到的最接近的是:

surf(peaks);
view(0,0)
ax(1) = gca;
axPos = ax(1).Position;
ax(2) = axes('Position',axPos, 'Color', 'none','XTick',[],'ZTick',[],'YAxisLocation','right');
linkprop(ax, 'CameraPosition');
rotate3d on

【问题讨论】:

  • 根据the documentation YAxisLocation 在切换到 3D 视图时会被忽略。
  • 我认为您必须通过自己手动创建带有刻度和刻度标签的第二个轴来“破解”系统。灵感可能在那里:mathworks.com/matlabcentral/fileexchange/3245-plot3axisatorigin
  • 谢谢两位。我会看看你的链接,克劳利,谢谢。 @Suever:我尝试绘制一个带有偏移量的隐形冲浪,以绕过您所说的问题,但没有成功。
  • 如果您对@Crowley 和 Suever 感兴趣。我想出了一个解决方案,我在下面发布了一个答案。感谢您的评论!
  • 我无法在 lats 评论中标记你们两个,所以我会在这里标记你们@Suever。也许这也是你感兴趣的。感谢您的评论!

标签: matlab plot axes


【解决方案1】:
% Desired plot
surf(peaks);

% Save axis
ax(1) = gca;

% Use the position of the first axis to define the new axis
pos = ax(1).Position;
pos2 = pos - [0.08 0 0 0];
ax(2) = axes('Position',pos2,'Color', 'none');

% Plot random line in 3D, just make sure your desired axis is correct
plot3(ones(length(peaks),1), 10:10:length(peaks)*10,...
    ones(length(peaks),1), 'Color','none')

% Make plot, and non-desired axes, invisible
set(gca,'zcolor','none','xcolor','none','Color','none')

% Link axes
linkprop(ax, 'View');

【讨论】:

  • 您可以在一个命令中设置所有gca 颜色。并将问题标记为已回答。
  • 当然,不知道为什么我有三行颜色。谢谢@克劳利!不过,直到明天我才能接受答案。我会尽快做的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-04
  • 2012-12-29
  • 2010-10-12
  • 2014-08-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多