0
votes

I am trying to plot some data and I noticed that the y-axis tick values were all the same. I tried to add more precision using y format, but it did not work. I am unsure what I may have done wrong.

I initially thought that the plots were reflective of the data, but I discovered that the values were all the same. What was initially confusing was that the y-axis just shows the same repeating value on the major tics.

There is another similar question on StackOverflow (Repeating y-axis tick labels), but the solutions there did not work for me, and I would like to understand why gnuplot does this (which is also not explained in the other question).

%> gnuplot -V
gnuplot 4.4 patchlevel 3

set term png font 'Liberation Sans,10' size 800,200
set output "data/plotid09-" . timestamp . ".png"
set style line 1 lt 1 lw 1 lc rgb "purple" pt -1
set xlabel "Time" font 'Liberation Sans,10'
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set xtics font 'Liberation Sans,10'
set ytics font 'Liberation Sans,10'
set format y "%8.4f"
set ylabel "Kelvin"
plot "data.txt" using 1:6 ls 1 smooth bezier with lines title "Temperature"

enter image description here

1
Your y-values don't happen to be in the range 274.150001 -- 274.150004 or similar?user707650
It seems the data is all the same (which is okay). So now I feel very silly. But the variation may be from floating point computations (??). Looking at the column ... cat data.txt | cut -f20 -s 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15 274.15Xofo
I will explore why Gnuplot handles the data in this way and report back.Xofo
If the data are all the same, that doesn't explain the curve, which is not a straight line. There must be minor variations at a scale that GNUplot can't properly put in the y tickmarks.user707650
Some plotting programs use an offset: the minimal variations are shown, all relative to an offset, which is often reported at the top of the axis with a '+' sign in front. Perhaps Gnuplot has this option.user707650

1 Answers

1
votes

I found the problem. Thanks for the comments and feedback.

Changing the line

plot "data.txt" using 1:6 ls 1 smooth bezier with lines title "Temperature"

to

plot "data.txt" using 1:6 ls 1 with lines title "Temperature"

fixed the issue. The problem was the "smooth bezier" option. I removed it and the problem went away, I saw a flat line and appropriate numbering on the major ticks as seen below. The plot below is an example of what one of the fields look like now (similar data, same issue).

enter image description here

#