使用gnuplot的一个X位置的两个Boxplots

时间:2022-12-06 13:02:31

I have 2 sets of data A and B, each with a y value for x=100, 200, 300. I want to create one graph which shows the difference between these two data sets. As such this means that for each x, there will be two boxplots(one for data A and one for data B).

我有两组数据A和B,每个都有一个y值为x = 100,200,300。我想创建一个图表,显示这两个数据集之间的差异。因此,这意味着对于每个x,将有两个箱图(一个用于数据A,一个用于数据B)。

for example, this is how the columns are organized in my data. DataSet A

例如,这是我的数据中列的组织方式。数据集A.

#  x=100 200 300 
  1    2   3    
 1.1  2.1  3.1
 1.2  2.2  3.2
 1    2   3    
 1.01 2.01 3.01

DataSet B

#  x=100 200 300 
  6    7   9    
 6.1  7.1  9.1
 6.2  7.2  9.2
 6    7    9    
 6.01 7.01 9.01

I was able to get two graphs out of this data using:

我可以使用以下方法从这些数据中获取两个图表:

set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set xtics ('100' 1, '200' 2, '300' 3)
plot for [i=1:3] "A.txt" using (i):i notitle
plot for [i=1:3] "B.txt" using (i):i notitle

However, I am facing issues when combining it into one. Please help.

但是,在将其合并为一个时,我遇到了问题。请帮忙。

1 个解决方案

#1


If you want to have them stacked above each other (in case they don't overlap), then you can just combine the two plot into one with

如果你想让它们堆叠在一起(如果它们没有重叠),那么你可以将两个图组合成一个

plot for [i=1:3] "A.txt" using (i):i notitle,\
     for [i=1:3] "B.txt" using (i):i notitle

If they can overlap, you may want to put them side-by-side with

如果它们可以重叠,您可能希望将它们并排放置

set boxwidth 0.3
plot for [i=1:3] "A.txt" using (i-0.15):i notitle,\
     for [i=1:3] "B.txt" using (i+0.15):i notitle

Just to give two example of how you could combine those plots.

只是举两个例子来说明如何组合这些图。

#1


If you want to have them stacked above each other (in case they don't overlap), then you can just combine the two plot into one with

如果你想让它们堆叠在一起(如果它们没有重叠),那么你可以将两个图组合成一个

plot for [i=1:3] "A.txt" using (i):i notitle,\
     for [i=1:3] "B.txt" using (i):i notitle

If they can overlap, you may want to put them side-by-side with

如果它们可以重叠,您可能希望将它们并排放置

set boxwidth 0.3
plot for [i=1:3] "A.txt" using (i-0.15):i notitle,\
     for [i=1:3] "B.txt" using (i+0.15):i notitle

Just to give two example of how you could combine those plots.

只是举两个例子来说明如何组合这些图。