How to add colors to every point in gnuplot from inside the point file

馋奶兔 提交于 2019-12-05 21:33:23

Try the following on gnuplot 4.6+:

rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
plot "data.dat" using 1:2:(rgb($3,$4,$5)) with points lc rgb variable

From the manual:

1.17.1.3 rgbcolor variable

variable tells the program to read RGB color information for each line in the data file. This requires a corresponding additional column in the using specifier. The extra column is interpreted as a 24-bit packed RGB triple. If the value is provided directly in the data file it is easiest to give it as a hexidecimal value (see 'rgbcolor'). Alternatively, the using specifier can contain an expression that evaluates to a 24-bit RGB color as in the example below. Text colors are similarly set using tc rgbcolor variable.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!