0
votes

I am trying to make a plot in gnuplot, using the "with boxes" command. The problem is that I can make the boxes more narrow, but the spacing between the boxes remains. This makes the plot look silly. link to picture

I have looked at margins, offset for the tics and tried to figure out the style of the boxes but could not get this to look nice.

First, I would like to understand what is causing the spacing. The box style or the tics? Of course, I will not name it ABCD, I will have longer tics then.

Later, I want to rotate it and include it in a LaTeX file, but the problem also exists in wxt terminal/graphical output from gnuplot.

The code I am using to generate the plot:

datenfile = "daten.txt"
yachsentitel = "Parameter [\\%]"
set ylabel yachsentitel 
unset key
unset grid
unset border
set boxwidth 0.2
set xtics rotate by 90 right 
set ytics rotate by 90 center
set style fill solid
set output "parameter.png"
set term png
plot datenfile using 2:xtic(1) with boxes

My data file is:

"A."            5.1
"B."            1.73
"C."            0.15
"D."            3.2
1

1 Answers

1
votes

The plot style "with boxes" wants two fields of information: x (horizontal placement) and y (height). Normally the plot command would be something like

  plot "data" using 1:2 with boxes

where x is in column 1 and y is in column 2.

If you provide only one data column specifier in the "using" part then it is interpreted as y and x values are generated from successive line numbers starting with 0. This is equivalent to what gnuplot calls "column 0" and the corresponding full command would be

 plot "data" using 0:1 with boxes

for which

 plot "data" using 1 with boxes

is a shorthand form. If you prefer to generate some other set of x positions you can put that into the using specifier explicitly:

 plot "data' using (column(0) * 0.1) : 2 : xtic(1) with boxes