Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a value associated to each day, as such:

120530    70.1
120531    69.0
120601    69.2
120602    69.5
# and so on for 200 lines

When plotting this data in gnuplot with lines, the data points are nicely connected. Unfortunately, at places over a week of data points can be missing. Gnuplot draws long lines over these intervals. How can I make gnuplot only connect points on consecutive days?

Solutions that require preprocessing of the data are fine, as I already smooth it with a script.

Here is what I use:

set xdata time
set timefmt "%y%m%d"
plot "vikt_ma.txt" using 1:2 with lines title "first line", \\
     ""            using 1:3 with lines title "second line"

Example: gnuplot example

share|improve this question
Here is a picture of the problem: (can't add images to the post for some reason). I want the circled area to be left blank. – Anna Jun 24 '12 at 15:05
Welcome to superuser. You can't because you just have not yet gathered enough reputation on this site. If you are unhappy with my changes you can of course revert them (or edit again). – Baarn Jun 24 '12 at 15:09
up vote 13 down vote accepted

Put an empty record (blank line) where there is no data. From the docs:

Single blank records designate discontinuities in a plot; no line will join points separated by a blank records (if they are plotted with a line style).

share|improve this answer
Thanks, this works for discontinuities in all series. What about if I have a discontinuity in one series, but not the other? – Anna Jun 24 '12 at 19:34
It worked by putting dashes instead of the values. – Anna Jun 24 '12 at 20:28
thanks @Anna, a dash solved my problem as well. – Adam Aug 26 '12 at 6:05
For me - it was a line with 2 space characters. – 3kstc May 2 at 23:35

You can use any string that is not a number as value for the missing data points or explicitly specify a missing data string using the set datafile missing command.

If you then plot the lines using

plot "vikt_ma.txt" using 1:($2) with lines title "first line"

then Gnuplot will leave a gap.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .