LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Gnuplot not displaying data correctly (https://www.linuxquestions.org/questions/linux-newbie-8/gnuplot-not-displaying-data-correctly-4175412829/)

Annielover 06-22-2012 08:14 AM

Gnuplot not displaying data correctly
 
Hi all,

I'm experiencing a little problem with Gnuplot:
I want to make a plot of a data file which contains of 2 colums: the first one is the date
and the second one is the CPU usage in %.
As you can see, multiple CPU times exists for one day.

But, gnuplot only plots the "13/6 64" and the "13/6 62" lines, not the others...

What did I wrong?

Code:

set terminal png truecolor
set output "test.png"
set autoscale
set style data lines
set xdata time
set timefmt "%d/%m"
plot "stats_cpu.txt" using 1:2 with boxes

Code:

13/6    63
13/6    70
13/6    60
13/6    64
14/6    62
14/6    63
14/6    57

Here is the output:

http://imageshack.us/content_round.p...94/testjen.png

dru8274 06-22-2012 11:07 AM

Could it be that gnuplot is plotting just two values, one each for when the date (%d/%m) is 13/6 and 14/6? Such that most of your data-points are being plotted against just the same two dates. But if each piece of data can be plotted against its own unique date/time, then the resulting gnuplot output will be much improved.

So you have only plotted your data against day and month. But perhaps if you plotted against hour, day and month (set timefmt "%H/%d/%m"), then each time-point would be unique, and your plot output fixed thusly?

Annielover 06-24-2012 04:59 AM

Thanks for your help, that worked!


All times are GMT -5. The time now is 03:13 AM.