Reputation: 33
I can't seem to figure out how to get gnuplot to parse my dates despite trying every combination. I'm trying to create a chart with years on the x axis and month and days on the y axis. All I get as a result is a chart with a line going from the bottom left to upper right and the date on the y axis is stuck on "01/01" and for the life of me I don't know what is wrong. Included here is my effort going back to the most basic setup:
I have a script which loops over an int and calls:
for c in `seq 2014 2015`;
do
w=$(ncal -e -y $c)
e=$(ncal -o -y $c)
echo $c, $w, $e
done
This creates data such as:
2014, April 20 2014, April 20 2014
2015, April 5 2015, April 12 2015
...
Gnuplot commands:
set ydata time
set format y "%m/%d"
set timefmt "%B %d %Y"
set datafile separator ","
plot "< ./dump.sh" using 1:2 with lines title "western", \
"< ./dump.sh" using 1:3 with lines title "eastern"
Any help would be appreciated.
Upvotes: 2
Views: 112
Reputation: 48390
The output format for the y-axis affects only the labels, but not the positions. So having only month and day in the ytic labels still includes the increasing years, which gives you the line.
Just use set timefmt "%B %d"
, which ignores the rest of the time string:
set datafile separator ","
set timefmt "%B %d"
set ydata time
set format y "%m/%d"
set style data lines
plot "< ./dump.sh" using 1:2 title "western", \
"< ./dump.sh" using 1:3 title "eastern"
Not using an explicit year uses either 2000 (version 4.6) or 1970 (development version) for the data. But that shouldn't matter at all for you application.
That gives (with 4.6.3):
Upvotes: 1