about drawing sinus function in gnuplot when it is pressed a keyboard -


is possible draw sinus function on interval: [-2*pi, 2*pi] in following way:

when press right arrow on keyboard produce sinus function on interval: [-2*pi, -pi]

when press again plot sinus function on interval [-pi, 0]

....

is possible?

thanks!

to plot when hitting key, must use bind command, like

clear bind left 'plot sin(x)' 

the clear opens empty plot windows, must give focus, , hit arrow-left key plot sine.

now can put more logic command called in bind:

clear = 0 left_lim(n) = (i%2 ? -pi : -2*pi) right_lim(n) = (i%2 ? 0 : -pi) bind left 'plot [-2*pi:2*pi][-1:1] (x < left_lim(i) || x > right_lim(i)) ? 1/0 : sin(x); = i+1'        

this draw sine on interval [-2*pi:-pi] @ every odd time press key, , on interval [-pi:0] @ every time press it. total xrange [-2*pi:2*pi] , yrange [-1:1].

depending on overall logic (what should happen if hit key third time?) must adapt script bit.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -