&引用;饼图“-类似于Gnuplot中散点图的数据点

&引用;饼图“-类似于Gnuplot中散点图的数据点,gnuplot,pie-chart,datapoint,Gnuplot,Pie Chart,Datapoint,我进入了数据分析阶段,我需要在一个图中显示多个维度,以便更好地强调相关性。为每个数据点放置一个饼图是最好的方法。在此附上我在以下位置找到的图: 如何在Gnuplot 5.2中生成这样的图形?我知道这是不可能的标准绘图类型,我正在寻找一个解决办法。我将沿着循环,使用Python制作一个脚本,生成这样一个情节 这里是上述示例的一个稍微简化的变体,尤其是plot命令更短更清晰 饼图的半径可以是固定的:第3列中的值>0,也可以是自动的:值数据是什么样子的?你检查过这个例子了吗?gnuplot 5.2中也

我进入了数据分析阶段,我需要在一个图中显示多个维度,以便更好地强调相关性。为每个数据点放置一个饼图是最好的方法。在此附上我在以下位置找到的图:

如何在Gnuplot 5.2中生成这样的图形?我知道这是不可能的标准绘图类型,我正在寻找一个解决办法。我将沿着循环,使用Python制作一个脚本,生成这样一个情节


这里是上述示例的一个稍微简化的变体,尤其是plot命令更短更清晰


饼图的半径可以是固定的:第3列中的值>0,也可以是自动的:值数据是什么样子的?你检查过这个例子了吗?gnuplot 5.2中也应该有这个例子。我没有固定的数据结构,它是灵活的。目前,我使用Python对数据进行预处理,在六列中列出圆的位置、半径、角度和颜色。这远非理想。谢谢,@theozh!这是一个非常巧妙的解决方案!这正是我想要实现的,但用两三个嵌套循环无法实现。我认为你的解决方案应该是一个教科书上的例子!
### plot with piecharts as points
reset session

$Data <<EOD
# x y    r  c1   c2   c3   c4   c5
2   16  -1  1.0  1.0  1.0  0.5  3.0
3    5  -1  0.8  0.7  0.5  0.9  0.8
7   15  -1  1.5  1.3  1.4  2.1  1.2
11  10  -1  5.6  8.7  3.1  3.1  9.4
12  19  -1  1.7  2.5  3.3  1.0  0.9
17   3  -1  4.1  5.1  1.4  0.5  5.3
19  14  -1  0.1  0.2  0.3  0.4  0.5
22  17  -1  2.1  2.2  3.2  4.2  1.5
EOD

stats $Data nooutput    # get the number of columns
colMax = STATS_columns
colMin = 4              # starting column for data
Scale = 0.3             # general scaling of circles
set angle degrees

Part(i) = sum [col=colMin:i] column(col)
Total(n) = Part(colMax)
Radius(r) = Scale * (r<0 ? sqrt(Total(0)) : r)    # radius<0: automatic calculation, proportional to sqrt
ArcStart = 90                                     # pie-chart start angle: 90=twelve o'clock
ArcDir = -1                                       # direction: -1 = clockwise, 1 = counterclockwise
ArcFrom(i) = ArcDir*Part(int(i)+(ArcDir<0?0:-1))/Total(0)*360 + ArcStart
ArcTo(i)   = ArcDir*Part(int(i)+(ArcDir<0?-1:0))/Total(0)*360 + ArcStart
ArcColor(i) = int(word("0xff0000 0x00ff00 0x0000ff 0xff00ff 0xffff00",i-colMin+1))

set xrange[0:25]
set yrange[0:25]
set grid xtics, ytics
set style fill solid 0.5 noborder

plot for [j=colMin:colMax] $Data u 1:2:(Radius($3)):(ArcFrom(j)):(ArcTo(j)):(ArcColor(j)) w circle lc rgb var notitle
### end of code