我正在使用matlab的瀑布绘制一些三维数据,我发现如果我使用buildin xlabel或ylabel命令设置x或y标签,标签的方向将始终是水平的而不是与轴对齐。 是否有任何方法使其沿轴线定向? 我在帮助中发现我们可以使用该命令
xlabel('label at 45 degree', 'rot', 45)指定方向角但是如果我手动旋转3D轴,标签不会相应改变,无论如何要修复它? 谢谢。
I am plotting some 3-dimensional data with matlab's waterfall, I found that if I set the x- or y-label with the buildin xlabel or ylabel command, the orientation of the label will always be horizontal instead of aligning with the axis. Is that any way to make it oriented along the axis? I found in the help that we can use the command
xlabel('label at 45 degree', 'rot', 45)to specify the angle of orientation but if I rotate the 3D axis manually, the label won't change accordingly, anyway to fix that? Thanks.
最满意答案
你不能自动完成。 您必须将tic标签/ X标签替换为文本对象并自行旋转( 请参阅此处以了解如何操作 )。 简单的解决方案如下:
plot(1:100); % make the axis smaller pos = get(gca, 'Position'); set(gca,'Position',[pos(1), .2, pos(3) 0.7]); % place custom text instead of xlabel % note that the position is relative to your X/Y axis values t = text(50, -5, {'X-axis' 'label'}, 'FontSize', 14); set(t,'HorizontalAlignment','right','VerticalAlignment','top', ... 'Rotation',45);还看看这个FEX的贡献 。
You can not do it automatically. You have to replace the tic labels/X label with text object and rotate it yourself (see here to know how to do it). Simple solution looks as follows:
plot(1:100); % make the axis smaller pos = get(gca, 'Position'); set(gca,'Position',[pos(1), .2, pos(3) 0.7]); % place custom text instead of xlabel % note that the position is relative to your X/Y axis values t = text(50, -5, {'X-axis' 'label'}, 'FontSize', 14); set(t,'HorizontalAlignment','right','VerticalAlignment','top', ... 'Rotation',45);Have also a look at this FEX contribution.
更多推荐
发布评论