【问题标题】:How to use color palette indexes for gnuplot box charts?如何为 gnuplot 箱形图使用调色板索引?
【发布时间】:2020-05-11 04:34:25
【问题描述】:

我尝试将一些索引映射到已定义调色板的颜色。但是定义的调色板似乎没有被使用。

给定一个文件data.txt:

11
22
33
44

gnuplot 命令:

set nokey
set grid
set style fill solid
set boxwidth 0.5
set yrange [0:]
set palette model RGB maxcolors 7
set palette defined (0 'dark-violet', 1 'skyblue', 2 'dark-yellow', 3 'dark-green', 4 'dark-red', 5 'coral', 6 'green', 7 'purple')
plot 'data.txt' using 0:1:(column(0)+1) with boxes linecolor variable

这给出:

这与定义的调色板不匹配。如何使 gnuplot 使用此处定义的调色板以及索引和颜色名称?

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    这是我想出的解决方案:

    set nokey
    set grid
    set style fill solid
    set yrange [0:]
    set palette defined (0 'dark-violet', 1 'skyblue', 2 'dark-yellow', 3 'dark-green', 4 'dark-red', 5 'coral', 6 'green', 7 'purple')
    set cbrange [0 : 7]
    unset colorbox
    plot 'data.txt' using 0:1:(0.5):(column(0)) with boxes linecolor palette
    

    解决方案是在绘图行中添加框宽(0.5) 并使用cbrangelinecolor palette

    【讨论】:

    猜你喜欢
    • 2016-10-01
    • 2022-01-04
    • 2019-07-03
    • 2013-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多