使用 frac 调色板的 Gnuplot 箭头线颜色

标签 gnuplot

我正在尝试按照许多来源中的建议使用 Palette frac 命令为箭头着色,但它对我不起作用。

这是我的 MWE:

set terminal pdfcairo fontscale 1.0 size 19in,9in
set sample 1000

set output "plot_files/mapping_test.pdf"

set palette defined (0 '#0000cc' , 1 '#c00000') model RGB

row_num = 10

do for [i=1:row_num]{
    x_val = (i-1.0)/(row_num-1)
    #set arrow i from first x_val, graph 0 to first x_val, graph 1 nohead lw 2 lc 
    palette frac (i-1.0)/(row_num-1)
    set arrow i from first x_val, graph 0 to first x_val, graph 1 nohead lw 5 lc 
    palette frac 0.5 
}

plot sin(x)

两者都不起作用,给出分数或计算它。 我可以使用 lc rgb "red" 更改颜色。

我使用的是版本 5.2 level 4

最佳答案

您发现了一个错误。感谢您的精彩报告。

您的脚本是正确的,但程序在决定是否激活调色板处理时没有注意到调色板颜色箭头的存在。它只看情节本身。好吧,也许它还会考虑其他一些事情,但显然不是箭头。

解决方法:一切都与您显示的完全一样,但添加了使用调色板的不可见绘图组件。程序肯定会注意到这一点,从而打开调色板处理,即使使用它的绘图组件不可见。

# all setup as before
# then
plot sin(x), NaN with lines lc palette notitle

如果您不希望右侧的示例调色板,请添加命令

unset colorbox

enter image description here

关于使用 frac 调色板的 Gnuplot 箭头线颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70042368/

相关文章:

vim - gnuplot 在 vi​​m 中突出显示

bash - 如何使用 system() 从 Perl 调用 gnuplot one-liner?

linux - 用于时间线数据的类似 gnuplot 的程序

plot - gnuplot 需要很长时间才能从大型数据集生成 3D 表面

gnuplot - 重置 xtics ytics gnuplot

gnuplot:在绘图点后面绘制网格并在前面绘制网格

csv - gnuplot 图标记数据

macos - 无法在 osx yosemite 上进行枪战。 undefined symbol

plot - 将一个图的 xrange 固定到另一个图

statistics - gnuplot 统计范围可能吗?