【问题标题】:Colormap in 2d plots in ScilabScilab 中二维图中的颜色图
【发布时间】:2015-11-20 13:20:37
【问题描述】:

在 Scilab 中使用plot(y) 函数时,y 是一个实数矩阵,在二维图上绘制多条数据曲线,并自动设置每条曲线的颜色。

根据 Scilab 在线帮助,使用默认颜色表(该命令循环该表并相应地为每条曲线着色):
http://help.scilab.org/docs/5.5.2/en_US/plot.html

问题是默认表格只列出了 7 种颜色,所以第 8 条数据曲线的颜色将与第 1 条相同,以此类推。

有没有办法扩展这个表格,自动为超过 7 条数据曲线着色?

我尝试在 3d 绘图中使用 colormap,但没有成功。

f = scf();
plot(myData);
f.color_map = jetcolormap(32);

我认为这仅适用于 3d 绘图。

【问题讨论】:

    标签: plot scilab


    【解决方案1】:

    您可以使用 for 循环通过 gce() 设置前景色。

    示例

    clf()
    
    number_of_points=100;
    number_of_lines=42;
    
    x=[1:number_of_points]
    
    for line_number = 1:number_of_lines
        plot(x, x+line_number);
        last_line = gce();
        last_line.children.foreground = line_number;
    end
    
    f = gcf();
    f.color_map= jetcolormap(number_of_lines);
    

    结果

    【讨论】:

      猜你喜欢
      • 2020-05-11
      • 2022-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-09
      • 2014-02-18
      相关资源
      最近更新 更多