开发者

How do I select a color for every point in Gnuplot data file?

I want t开发者_StackOverflow中文版o plot points, each with X, Y and a color. How do I do that in Gnuplot?


You can try something like this:

Line plot in GnuPlot where line color is a third column in my data file?

For example:

plot "./file.dat" u 1:2:3 with points palette

where file.dat contains your data, the first column is the x axis and the second column is the y axis, the third column is the colour.


You could consider looking at the Pyxplot plotting package http://pyxplot.org.uk, which has very similar syntax to gnuplot (albeit cleaned up considerably), and which allows point styles to be specified on a point-by-point basis. For example, in Pyxplot:

plot "file.dat" using 1:2:3 with points color rgb($4,$5,$6)

would take the RGB components for the color of each point from the 4th, 5th and 6th columns of the data file. Alternatively,

plot "file.dat" using 1:2:3 with points color $4

would read the numbers in the 4th column of the data file (call it n), and plot each point with the n-th color from the palette. If n is non-integer, say 2.5, it gives you a color half way between color 2 and color 3 in RGB space.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜