0
votes

I have two columns of data displayed as a scatter plot in Gnuplot 5.4 (on Big Sur). Adding the mean of the second column produces a horizontal line at the appropriate value on the y-axis. However, the first column's mean also shows as a horizontal line at the value on the y-axis. Is it possible to have it instead display as a verticle line at the appropriate value on the x-axis?

stats 'sleep.dat' using 1 name "A"
stats 'sleep.dat' using 2 name "B"
set xlabel "Hours"
set ylabel "Events"
set title "Apnea Events/Hours of Sleep"
set xrange [3:9]
set yrange [0:4]
set xtics 0.5
set ytics 0.25
plot 'sleep.dat' lc 9 lw 5, A_mean lw 2, B_mean lw 2
5.300   0.0
5.083   0.0
5.517   0.0
5.500   0.0
0.000   0.0
6.383   0.3
5.883   0.8
5.600   0.3
6.733   0.5
5.683   0.1
5.867   0.1
5.666   4.2
5.917   2.4
8.667   0.8
6.783   0.8
6.483   1.0
5.867   0.6
6.050   0.3
6.967   1.0
6.433   0.4
6.750   1.4
8.583   0.3
6.167   0.1
6.483   1.3
5.600   2.1
6.417   0.6
8.425   1.2
8.833   1.3
6.483   0.4
7.700   0.2
7.667   1.0
5.517   0.0
7.567   0.2
5.383   1.1
7.483   0.6
7.567   0.6
6.517   0.4
6.633   0.3
5.383   2.0
6.033   0.8
5.000   1.1
6.300   0.9
5.933   0.5
6.583   0.1
7.650   0.1
8.667   0.0
7.700   0.7
7.567   0.9
5.800   0.1
5.783   0.6
8.733   0.7
6.333   0.5
7.133   0.4
6.783   0.5
5.983   0.3
8.283   0.8
7.300   0.0
6.283   0.0
6.683   0.1
6.44    0.1
6.417   0.3
5.117   1.9
8.167   0.7
6.233   0.8
6.567   1.3
6.800   0.2
6.420   0.7
5.450   0.9
5.067   1.1
6.520   0.1
6.017   0.3
6.300   1.2
5.850   0.8
6.883   0.1
5.767   0.0
5.833   0.6
7.1     0.2
6.733   0.0
6.367   0.1
6.833   0.1
7.350   0.5
7.183   1.5
7.950   2.1
7.200   0.5
6.183   0.1
5.867   0.0
5.983   0.3
7.483   0.1
5.633   0.7
8.517   0.4
5.650   0.1
6.583   0.0
7.333   0.5
7.083   1.4
5.683   0.3
6.483   0.1
5.550   0.3
6.250   0.3
6.383   0.4
4.533   0.0
6.483   0.9
6.167   0.8
1
Welcome to stackoverflow. When asking a question of this sort, please show the command you used to generate the plot you are asking about. In some cases it may also help respondents if you include sample data and/or an image file or screenshot of the unsatisfactory output. In the current case we don't know what you have done that produces the output you describe, so it is hard to suggest a change. - Ethan

1 Answers

0
votes

To draw a vertical line from the top to the bottom of a graph, you can actually use an arrow without a head:

set arrow from B_mean, graph 0 to B_mean, graph 1 nohead