【问题标题】:How can I change the edge line color when using the 'fill' function in MATLAB?在 MATLAB 中使用“填充”函数时如何更改边缘线颜色?
【发布时间】:2011-04-17 06:34:20
【问题描述】:

我正在编写代码,其中我使用 MATLAB 的 fill 命令来绘制 2D 形状。我可以指定形状的填充颜色。但是,边界线颜色始终为黑色。我希望边框线颜色与填充颜色相同。我如何还可以指定边框线颜色?

【问题讨论】:

    标签: matlab graphics colors plot shapes


    【解决方案1】:

    this thread:

    To set the edgecolor to white do the following.
    
    h = fill([-1 -1 1 1],[-1 1 1 -1],'w');
    axis([-2 2 -2 2]);
    set(h,'edgecolor','white');
    

    应该注意边界。

    【讨论】:

      【解决方案2】:

      除了schnaader's answer,还可以在初始调用FILL时设置边缘颜色:

      hPatch = fill(xData,yData,'r','EdgeColor','r');  %# Red patch with red edges
      

      或者完全停止绘制边缘:

      hPatch = fill(xData,yData,'r','EdgeColor','none');  %# Red patch with no edges
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-05-03
        • 1970-01-01
        • 2021-05-23
        • 2018-05-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多