Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: Jonathan Lynch <jlynch@fr...>  20050630 16:06:26

I have data as follows which I want to plot in gnuplot. The first column has floating point data which corresponds to the time of day in seconds with microsecond precision. eg 58765.941980 corresponds to 16:19:25.941980. (hours:mins:sec.micro). The 2nd column corresponds to network latency in microseconds. 58765.941980 0.151529 58766.547128 0.151253 58766.649092 0.135645 58766.751071 0.101977 58766.853054 0.113067 58766.955028 0.141189 58767.715886 0.154117 58767.817853 0.156928 58767.919834 0.146146 58768.021811 0.114410 There are potentially ten data points in the space of a second. If i express time in the format 16:19:25.941980 the graph is inaccurate because gnuplot does not support fractions of a second due to using the tm structure. So Im going to stick to plotting the floating point data. Gnuplot generates tics on the xaxis and labels them. What is the algorithm where gnuplot calculates where the tics should be? I could write a C program to parse through the data file and generate a file with gnuplot commands. if i knew exactly where the tics were going to be I could put some tics manually eg. set xtics ("16:19:25",58765.0, 16:19:30",58770.0) and so on. So that the X axis would have labels with time values. So my question again is What is the algorithm where gnuplot calculates where the tics for floating point data on the xaxis should be? I would appreciate and replys Jonathan Lynch 
From:
<broeker@ph...>  20050630 19:33:31

Jonathan Lynch wrote: > There are potentially ten data points in the space of a second. If i > express time in the format 16:19:25.941980 the graph is inaccurate > because gnuplot does not support fractions of a second due to using the > tm structure. It'll only be inaccurate if a second is still wider than one pixel on the actual output format. Whether that's the case depends on the output format, and the length of the interval you have measurements for. > So Im going to stick to plotting the floating point data. Gnuplot > generates tics on the xaxis and labels them. What is the algorithm > where gnuplot calculates where the tics should be? It's complicated. The general scheme is: "divide the range into intervals of 'nice' length, such that there are between 5 and 10 of them" > I could write a C program to parse through the data file and generate a > file with gnuplot commands. if i knew exactly where the tics were going > to be I could put some tics manually eg. > set xtics ("16:19:25",58765.0, 16:19:30",58770.0) and so on. Why do you think you have to know the tick placement for that? This command will override the automatically placed tick positions, so it doesn't matter where they would have gone. 
From: Jonathan Lynch <jlynch@fr...>  20050701 15:18:51

I have gone through the code for axis.c in the gnuplot sources. Below= is some pseudo code containing the pieces of code that I think are relev= ant to what I am trying to do and also my understanding of what they do. Again I am using a C program to calculate the position of xtics. Then when i generate a "set xtics" command that will contain all the tic values I want along with labels ( which is going to be minutes:second= s). The maximum range of what I want to graph will be 1 hour, but realistically it will be about 500 seconds.=20 I dont understand how the tic interval is calculated in the funtion= =20 quantize_normal_tics. Could someone explain to me using pseduo code e= tc how it works ? Also the function quantize_duodecimal_tics rounds the tic interval. I= t is called from the quantize_time_tics function when the format of the axis is time. It seems to be similar to the quantize_normal_tics function. I would appreciate any responses Jonathan =  void setup_tics(axis, max) { =09//part that im interested in =09 =09//TIC_COMPUTED =3D default; gnuplot figures them =09} else if (ticdef>type =3D=3D TIC_COMPUTED) { =09=09 ticstep[axis] =3D tic =3D make_tics(axis, max); =09} } static double make_tics(axis, guide) { =09range =3D absolute(max  min) =09 =09//i presume tic refers to the tic interval =09//calculate the tic interval =09tic =3D quantize_normal_tics(range, guide); =09//I want to use time data =09//this rounds the tic interval to a nice figure =09quantize_time_tics(axis, tic, range, guide); } //calculate the tic interval  dont understand the logic behind this double=09quantize_normal_tics(range, guide) { =09floor ( base 10 log of the range) =09. =09. =09. =09. =09 =09//seems complicated } //round tic interval to a nice value static double quantize_time_tics(axis, tic, xr, guide) { =09//i will be graphing data whose range will be 1 hour maximum =09//realistically the range will be about 500 seconds =09//60 * 60 =3D 3600 sec =09 timelevel[axis] =3D TIMELEVEL_SECONDS; =09 if (tic > 5) { =09 /* turn tic into units of minutes */ =09 tic =3D quantize_duodecimal_tics(xr / 60.0, guide12) * 60; =09 if (tic >=3D 60) =09 timelevel[axis] =3D TIMELEVEL_MINUTES; =09 } } //again dont understand the logic behind this  it seems to me that i= t uses some of the logic from the quantize_normal_tics function static double=09quantize_duodecimal_tics(arg, guide) { =09//seems complicated } /* make smalltics for timeaxis */ //i presume these are the minor tics.=20 //not exactly sure what order this function is called static double make_auto_time_minitics(tlevel, incr) { =09//part that seems relevant to me case TIMELEVEL_SECONDS: case TIMELEVEL_MINUTES: if (incr >=3D 5) tinc =3D 1; if (incr >=3D 10) tinc =3D 5; if (incr >=3D 20) tinc =3D 10; if (incr >=3D 60) tinc =3D 20; if (incr >=3D 2 * 60) tinc =3D 60; if (incr >=3D 6 * 60) tinc =3D 2 * 60; if (incr >=3D 12 * 60) tinc =3D 3 * 60; if (incr >=3D 24 * 60) tinc =3D 6 * 60; break; } On Thu, 20050630 at 21:35 +0200, HansBernhard Br=C3=B6ker wrote: > Jonathan Lynch wrote: >=20 > > There are potentially ten data points in the space of a second. I= f i > > express time in the format 16:19:25.941980 the graph is inaccurat= e > > because gnuplot does not support fractions of a second due to usi= ng the > > tm structure. >=20 > It'll only be inaccurate if a second is still wider than one pixel = on=20 > the actual output format. Whether that's the case depends on the o= utput=20 > format, and the length of the interval you have measurements for. >=20 > > So Im going to stick to plotting the floating point data. Gnuplot > > generates tics on the xaxis and labels them. What is the algorit= hm > > where gnuplot calculates where the tics should be? >=20 > It's complicated. The general scheme is: "divide the range into > intervals of 'nice' length, such that there are between 5 and 10 of= them" >=20 > > I could write a C program to parse through the data file and gene= rate a > > file with gnuplot commands. if i knew exactly where the tics were= going > > to be I could put some tics manually eg. > > set xtics ("16:19:25",58765.0, 16:19:30",58770.0) and so on. >=20 > Why do you think you have to know the tick placement for that? Thi= s=20 > command will override the automatically placed tick positions, so i= t=20 > doesn't matter where they would have gone. >=20 >=20 >=20 >  > SF.Net email is sponsored by: Discover Easy Linux Migration Strateg= ies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op= =3Dclick > _______________________________________________ > Gnuplotinfo mailing list > Gnuplotinfo@... > https://lists.sourceforge.net/lists/listinfo/gnuplotinfo 