【发布时间】:2021-05-28 14:24:46
【问题描述】:
我正在尝试使用收到的建议制作二维散点图 Cannot get labels to color in GNUPlot
这导致我写:
$DATA << EOD
3.12960004005165 2.67469663590573 0.438527882947657
3.54159282682062 1.48608712150729 3.45059090334765
1.41832139944261 1.09739773669576 4.7851179962913
0.37050714994141 4.51679511956513 2.99273024822522
1.33417336450785 2.60931115605578 3.49852244355505
4.68608825227413 4.50263530942483 0.708639941290272
EOD
set datafile separator "\t"
set xlabel 'x'
set ylabel 'y'
set title 'title'
set terminal svg
set output 'scatterplotx_y.svg'
set key off
myColor(col) = int("0x".strcol(col)[3:])
plot $DATA using 1:2:(myColor(3)) pt 7
我正在使用 gnuplot 5.2 补丁级别 8
我也试过
plot $DATA u 1:2:3 with lines palette
Line plot in GnuPlot where line color is a third column in my data file? 建议,但这不起作用
plot $DATA u 1:2:3 with points color $3
我现在正在使用调色板:
set palette defined (0 "red", 0.3 "orange", 0.625 "green", 0.85 "blue", 1 "dark-violet")
我的问题:
如何绘制由 [0,1] 中的数字确定的从红色到紫色的颜色,这里是第 3 列?其中红色是 0,1 是紫色,中间是彩虹的所有颜色?
【问题讨论】:
-
这可能对您的目标有所帮助:stackoverflow.com/a/59239638/7295599 不过,这不是最终解决方案。