如果 theozh 的答案不适用,例如,如果您想要一个颜色不是整个绘图的键条目,那么当前的 gnuplot(版本 5.2.6 或更高版本)提供了一个特殊的绘图组件keyentry
,可为任何绘图样式生成标题和样本没有实际绘制任何东西。例子:
set key title "Key made with explicit \n{/:Italic keyentry} elements"
plot keyentry with points pt '¶' title "points", \
keyentry with lp title "lp", \
keyentry with yerrorbars title "yerrorbars", \
keyentry with xyerrorlines title "xyerrorlines", \
keyentry with circles fs solid fc "dark-red" title "circles", \
keyentry with ellipses title "ellipses", \
sin(x)/x lc "grey" dt '.-' lw 3 title "normal plot", \
keyentry with boxerrorbars title "boxerrorbars", \
keyentry with boxplot fs pattern 1 title "boxplot", \
keyentry with labels point pt 4 title "labels", \
keyentry with vectors title "vectors"