【问题标题】:No effect of activating BOX in axes properties in MATLAB在 MATLAB 中的轴属性中激活 BOX 无效
【发布时间】:2014-08-09 11:31:36
【问题描述】:

我想在 MATLAB 中的 pie3 图形之外有一个框(边框),但是当我在 axes 中激活 (On) Box property 时,会出现注释。我将AmbientLightColor 更改为黑色,但我遇到了同样的问题。

如何在gui(GUIDE) 中为我的pie3 图形绘制黑线边框?

谢谢。

附言。

Luis Mendo Idea 有这个效果:

我们这里有一个 3D 立方体,而不是一个 2D 普通盒子。

【问题讨论】:

    标签: matlab user-interface plot border matlab-guide


    【解决方案1】:

    使用pie3 后坐标区不可见。你应该让它们可见:

    set(gca,'Visible','on')
    

    可选,

    set(gca,'Box','on')
    

    将添加轴的“外部”。

    【讨论】:

    • 感谢您的回答。 gca 指的是pie3 handleaxes handle 还是total figure(window) handle
    • @user2991243 gca 是一个返回当前句柄的Matlab函数。如果将其存储在变量中,则可以将其替换为轴句柄。另外,请注意轴是 3D 的;不知道这是不是你想要的
    • pie3 调用之前复制坐标轴并清除背景颜色可能看起来“更漂亮”,因此它用 2d 框而不是 3d 框覆盖饼图。
    • @excaza 好主意。不过,不确定如何“复制坐标轴”
    • 我在主要问题中添加了输出图和信息。谢谢。
    【解决方案2】:

    正如我在 cmets 中提到的,获得 2D 边框的另一种选择是制作两个轴,一个用于框和背景,另一个用于您的 pie3 调用:

    x = [1,3,0.5,2.5,2]; % Sample data
    mainfig = figure;
    h_overlayaxes = axes( ...
        'Box','on', ...      % Turn on border
        'Color',[1 1 1], ... % Set your background color
        'Xtick',[], ...      % Turn off x ticks
        'Ytick',[] ...       % Turn off y ticks
        );
    h_plotaxes = axes( ...
        'Parent',get(h_overlayaxes,'Parent'), ...     % Match parent figure
        'Position',get(h_overlayaxes,'Position'), ... % Match overlay size & position
        'Color','none' ...                            % Turn off background
        );
    
    pie3(x);
    

    【讨论】:

      猜你喜欢
      • 2012-02-12
      • 2013-08-17
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-25
      相关资源
      最近更新 更多