pulling x-axis time information from a binary file

View: New views
3 Messages — Rating Filter:   Alert me  

pulling x-axis time information from a binary file

by Johannes russek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everybody,

I have a binary file that was created with pack("l*",$time,$value); from
php.

I can plot the contents of the file fine with

unset key
set xtics rotate
plot 'data.bin' binary format='%int32%int32' using 1:2 with lines

however, i would like to have the tics on the x-axis as readable
date/time.
but when i use this (with or without set timefmt "%s"):

unset key
set xdata time
set format x "%r %D"
set xtics rotate
plot 'data.bin' binary format='%int32%int32' u 1:2 with lines

i only get an error:

gnuplot> plot 'data.bin' binary format='%int32%int32' u 1:2 with lines
                                                                 ^
         line 0: warning: Skipping data file with no valid points

gnuplot> plot 'data.bin' binary format='%int32%int32' u 1:2 with lines
                                                                      ^
         line 0: x range is invalid

what am i doing wrong or how can i read time values from a binary file?

Thanks,
Johannes



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: pulling x-axis time information from a binary file

by Thomas Sefzick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

'binary' and 'time/date' somehow don't work together,
gnuplot still expects the date as a string in 'binary' mode.
this somehow doesn't make sense...

if you want to compile your own special version of gnuplot
try the following patch:

> diff -u src/datafile.c.orig src/datafile.c
--- src/datafile.c.orig 2009-10-24 11:14:18.000000000 +0200
+++ src/datafile.c      2009-10-24 11:30:18.000000000 +0200
@@ -4539,20 +4539,15 @@
                    struct tm tm;
 
                    if (column > df_no_cols
-                       || df_column[column - 1].good == DF_MISSING
-                       || !df_column[column - 1].position
-                       || !gstrptime(df_column[column - 1].position,
-                                     axis_array[df_axis[output]].timefmt,
-                                     &tm)) {
+                       || df_column[column - 1].good == DF_MISSING) {
                        /* line bad only if user explicitly asked
                         * for this column */
                        if (df_no_use_specs)
                            line_okay = 0;
-
                        /* return or ignore line depending on line_okay */
                        break;
                    }
-                   v[output] = (double) gtimegm(&tm);
+                   v[output] = df_column[column - 1].datum;
                } else if ((column <= df_no_cols)
                           && df_column[column - 1].good == DF_GOOD)
                    v[output] = df_column[column - 1].datum;

Johannes russek wrote:
Hello everybody,

I have a binary file that was created with pack("l*",$time,$value); from
php.

I can plot the contents of the file fine with

unset key
set xtics rotate
plot 'data.bin' binary format='%int32%int32' using 1:2 with lines

however, i would like to have the tics on the x-axis as readable
date/time.
but when i use this (with or without set timefmt "%s"):

unset key
set xdata time
set format x "%r %D"
set xtics rotate
plot 'data.bin' binary format='%int32%int32' u 1:2 with lines

i only get an error:

gnuplot> plot 'data.bin' binary format='%int32%int32' u 1:2 with lines
                                                                 ^
         line 0: warning: Skipping data file with no valid points

gnuplot> plot 'data.bin' binary format='%int32%int32' u 1:2 with lines
                                                                      ^
         line 0: x range is invalid

what am i doing wrong or how can i read time values from a binary file?

Thanks,
Johannes



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: pulling x-axis time information from a binary file

by Johannes russek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Samstag, den 24.10.2009, 02:46 -0700 schrieb Thomas Sefzick:
> 'binary' and 'time/date' somehow don't work together,
> gnuplot still expects the date as a string in 'binary' mode.
> this somehow doesn't make sense...
>
> if you want to compile your own special version of gnuplot
> try the following patch:

Hello Thomas,
thanks for your answer. However, i think compiling my own special
version of gnuplot doesn't go well with our goals ;)
I'll try to work out some other way, in the worst case having to convert
to text files.
Is there any other way to supply gnuplot with the date/time information?
regards,
Johannes


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info