Gnuplot平行坐标/轴绘制关键注释

use*_*632 7 visualization graph gnuplot

我可以用Gnuplot 5.0绘制平行坐标图.例如:

plot "ranking_top10.dat" using 4:5:6:7:8:2 with parallel lt 1 lc variable
Run Code Online (Sandbox Code Playgroud)

将绘制5个轴和不同颜色的线条.但是,我想将键与每个行关联起来.例如,我想将一个键(字符串)与紫色线相关联,并在图中显示它.怎么做?

parallel_axes

the*_*ozh 1

这个问题相当“老”,但仍然没有答案。也许答案仍然令人感兴趣。不幸的是,您尚未提供生成绘图的完整代码和数据。

就您而言,我不知道自动生成密钥的简单直接方法。因此,解决方法是通过绘制到虚拟表以及虚拟绘制来将标题和颜色放入字符串中NaN以获取图例/键。使用 gnuplot 5.0.0 和 5.2.6 进行测试

代码:

### parallel plot with proper keys
reset session

$Data <<EOD
1   1   "Set A"   5000    30000    51  0.35 0.23
2   2   "Set B"   8000    80000    20  0.5  -0.5
3   3   "Set C"   6000    20000    38  0.75 0.12
4   4   "Set D"   8000    50000    17  1.9  0.32
5   5   "Set E"   70000   110000   62  2.99 0.5
6   6   "Set F"   0       0        0   0    0
7   7   "Set G"   40000   130000   38  0.80 -0.05
8   8   "Set H"   3000    30000    19  0.55 0.1
9   6   "Set I"   11000   50000    22  1.75 0.12
EOD

unset border
set key out top right
set xrange[0.2:5.5]
set xtics 1 format "axis %g" scale 0,0
unset ytics

set for [i=1:5] paxis i tics format "%g" right offset 1.5,0  # ok for gnuplot 5.2.6
# set paxis 3 tics format "%g" right offset -1,0             # required (uncomment) for gnuplot 5.0.0

# create titles and colors
myTitles = myColors = ""
set table $Dummy
    plot $Data u (myTitles = myTitles.'"'.strcol(3).'" '), \
         '' u (myColors = myColors.sprintf("%g ",column(2))) w table
unset table

plot $Data u 4:5:6:7:8:2 w parallel lw 2 lc var not, \
     for [i=1:9] NaN w l lw 2 lc word(myColors,i) ti word(myTitles,i)
### end of code
Run Code Online (Sandbox Code Playgroud)

结果:

在此输入图像描述