【问题标题】:Set line width for fplot in Octave在 Octave 中为 fplot 设置线宽
【发布时间】:2018-06-10 09:30:30
【问题描述】:

这段代码

fplot(@sin, [0 4], 'LineWidth', 2)

在 MATLAB 中工作,但使用 Octave 会给出错误消息。如何在 Octave 中设置fplot 的曲线宽度?

【问题讨论】:

    标签: matlab octave


    【解决方案1】:

    Dimitry’s answer 可能更好,不过你也可以找到线柄并修改:

    fplot(@sin, [0 4])
    h = findobj(gca, 'type', 'line');
    set(h, 'LineWidth', 2)
    

    【讨论】:

    • 我相信这样更好。
    【解决方案2】:

    Octave 在不常用的区域中充满了错误。这可能就是其中之一。

    改用普通的plot 函数。

    %get data
    [x,y]=fplot(@sin, [0 4]);
    %or
    x=0:0.1:4; y=sin(x); 
    
    %plot data
    plot(x,y, 'LineWidth', 10)
    %or
    l=plot(x,y);
    set(l,'LineWidth', 10)
    

    【讨论】:

    • 注意:对于 fplot 有两个输出参数会被 Mathworks 折旧。 MATLAB R2018a 还警告它在未来版本中的删除,并建议改用 XDataYData 属性。
    猜你喜欢
    • 2021-12-03
    • 1970-01-01
    • 2016-05-10
    • 1970-01-01
    • 2014-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-07
    相关资源
    最近更新 更多