Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3642 > unrolled thread

Is Subsecond Pause Possible?

Started by"F. Russell" <fr@random.info>
First post2017-05-14 15:03 +0000
Last post2017-05-14 18:47 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Is Subsecond Pause Possible? "F. Russell" <fr@random.info> - 2017-05-14 15:03 +0000
    Re: Is Subsecond Pause Possible? Karl Ratzsch <mail.kfr@gmx.net> - 2017-05-14 19:07 +0200
    Re: Is Subsecond Pause Possible? Ethan A Merritt <EAMerritt@gmail.com> - 2017-05-14 10:54 -0700
      Re: Is Subsecond Pause Possible? "F. Russell" <fr@random.info> - 2017-05-14 18:47 +0000

#3642 — Is Subsecond Pause Possible?

From"F. Russell" <fr@random.info>
Date2017-05-14 15:03 +0000
SubjectIs Subsecond Pause Possible?
Message-ID<of9rk60164o@news4.newsguy.com>
Hello,

I am attempting to produce simple animations using gnuplot:

set parametric

a_time=0

plot f(a_time), g(a_time) with points pt 7 ps 2 lc 2

do for [i=1:400] { \
replot f(a_time), g(a_time) with points pt 7 ps 2 lc 2; \
a_time=a_time+0.01; \
pause 0.3 }

This method works very well in producing a moving point
but the interval between replots is too large.  Even though
I have specified a 0.3 second pause, the pause is actually
1 second.

The gnuplot manual states:

"The time is rounded to an integer number of seconds if subsecond
time resolution is not supported by the given platform."

The terminals I use are x11 and wxt on a GNU/Linux Intel Core i7
system.

Is a subsecond pause possible with gnuplot or will the time
always be rounded to the next second?

[toc] | [next] | [standalone]


#3643

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2017-05-14 19:07 +0200
Message-ID<ofa2t6$mud$1@solani.org>
In reply to#3642
Am 14.05.2017 um 17:03 schrieb F. Russell:

> "The time is rounded to an integer number of seconds if subsecond
> time resolution is not supported by the given platform."
> 
> The terminals I use are x11 and wxt on a GNU/Linux Intel Core i7
> system.
> 
> Is a subsecond pause possible with gnuplot or will the time
> always be rounded to the next second?
> 

I see no rounding on my system (ubuntu 17.04, gnuplot 5.0pl6):

  t0=time(0.); do for [i=1:5] {pause 0.1}; print time(0.)-t0

takes 0.501 seconds.

Can you be more specific about your system, i.e. OS and version,
gnuplot version?

  Karl

[toc] | [prev] | [next] | [standalone]


#3644

FromEthan A Merritt <EAMerritt@gmail.com>
Date2017-05-14 10:54 -0700
Message-ID<ofa5e8$4q5$1@dont-email.me>
In reply to#3642
F. Russell wrote:

> Hello,
> 
> I am attempting to produce simple animations using gnuplot:
> 
> set parametric
> 
> a_time=0
> 
> plot f(a_time), g(a_time) with points pt 7 ps 2 lc 2
> 
> do for [i=1:400] { \
> replot f(a_time), g(a_time) with points pt 7 ps 2 lc 2; \
> a_time=a_time+0.01; \
> pause 0.3 }
> 
> This method works very well in producing a moving point
> but the interval between replots is too large.  Even though
> I have specified a 0.3 second pause, the pause is actually
> 1 second.

I am pretty sure you want "plot ..." rather than "replot...",
or else you want "replot;" with no trailing functions.

As it stands your "replot" instruction creates a longer plot sequence
each time it executes, so by the end of your loop it is drawing
400 plots on top of each other per iteration.  I can see how
that might slow it down.  

Nevertheless, if I change that to "pause delta" and set
"delta = 0.01" before the loop then I see a 
rapid animation despite the redundant replotting.

 
> The gnuplot manual states:
> 
> "The time is rounded to an integer number of seconds if subsecond
> time resolution is not supported by the given platform."
> 
> The terminals I use are x11 and wxt on a GNU/Linux Intel Core i7
> system.
> 
> Is a subsecond pause possible with gnuplot or will the time
> always be rounded to the next second?

I think all modern platforms support subsecond resolution.
The caveat is left over from MSDOS days.

	Ethan

[toc] | [prev] | [next] | [standalone]


#3645

From"F. Russell" <fr@random.info>
Date2017-05-14 18:47 +0000
Message-ID<ofa8ok01s78@news3.newsguy.com>
In reply to#3644
On Sun, 14 May 2017 10:54:21 -0700, Ethan A Merritt wrote:

> 
> I am pretty sure you want "plot ..." rather than "replot...",
> or else you want "replot;" with no trailing functions.
> 
> As it stands your "replot" instruction creates a longer plot sequence
> each time it executes, so by the end of your loop it is drawing
> 400 plots on top of each other per iteration.  I can see how
> that might slow it down.  
> 

Thank you for that explanation.  It does solve the problem.

I need to set up a different graph before the animation
and so I can't use "plot" command in the animation because it will
destroy the original graph.  I need to use the "replot" command. 

But now I can just plot the original graph and then plot the initial
point of the animation using "replot f(t), g(t)".  Then I run the
rest of the animation only "replot;".

set parametric
# plot the first graph
set trange [0:2*pi]; plot cos(t), sin(t) with lines lw 8

#plot the initial point of the animation with "replot f(t), g(t)" 
a_time=0
replot f(a_time), g(a_time) with points pt 7 ps 2 lc 2

# perform the animation with just "replot;"
do for [i=1:400] { \
a_time=a_time+0.01;
replot; \
pause 0.3 }

Now the pauses are less than 1 second and the animation runs
smoothly.

Thanks again.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web