|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Gnuplot shell script controlled animation
Hi,
I am looking for basic shell script to feed Gnuplot with live data, to arrange basic animation. I mean one-liner one variable real function. Any idea or experiences from the past, generating Gnuplot animation on dumb terminal (ASCII only) ? Or please refer me to a nice web site. Darius |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Quote:
Quote:
|
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Quote:
thank you very much for your kind reply. I have played with gnuplot in the night and here are my basic results. Having learned loop syntax for code refresh in gnuplot load "loop3.plt" loop3.plt code ========== a = a + 1 f(x) = (x*x+a) plot f(x) if(a<5) reread =========== init terminal strings [admin@oo local]$ gnuplot G N U P L O T Version 4.2 patchlevel 4 last modified Sep 2008 System: Linux 2.4.20 Copyright (C) 1986 - 1993, 1998, 2004, 2007, 2008 Thomas Williams, Colin Kelley and many others Type `help` to access the on-line reference manual. The gnuplot FAQ is available from gnuplot: FAQ Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot> Terminal type set to 'unknown' gnuplot> set terminal dumb Terminal type set to 'dumb' Options are 'feed 79 24' gnuplot> a=-5 gnuplot> load "loop3.plt" (I get series of slides generated) 110 ++---------------+-----------------+----------------+---------------++ * + + + f(x) ****** * 100 +* *+ | * * | 90 ++ * * ++ 80 ++ * * ++ | ** ** | 70 ++ * * ++ | ** ** | 60 ++ ** ** ++ | * * | 50 ++ ** ** ++ | * * | 40 ++ ** ** ++ | ** ** | 30 ++ *** *** ++ 20 ++ ** ** ++ | *** *** | 10 ++ ***** ***** ++ + + ************ + + 0 ++---------------+-----------------+----------------+---------------++ -10 -5 0 5 10 gnuplot> ======== Modified code to a = a + 1 f(x) = (x*x+a) plot f(x) clear if(a<5) reread but still a series of slides is generated. Expected to clear screen before next slide is sent to terminal. Ok. So the above example is my first test in basic gnuplot animation on ASCII dumb terminal. ============ In the meantime I visited your Shell Scripting Recipes reading sample chapter and testing your split_date "DATE" [VAR1 [VAR2 [VAR3]]] saved script code as splitdate, chmod 777 ./splitdate and try to run it [admin@oo root]$ ./splitdate "1949-09-29" [admin@oo root]$ printf "$format" "$SD_DAY" "$SD_MONTH" "$SD_YEAR" Day: Month: Year: [admin@oo root]$ Could you kindly tell me how to make it working ? I copy&pasted it into nano editor appended #!/bin/sh and saved into root directory chmod 777 ./splitdate How to make it run $ splitdate instead of $ ./splitdate ? ================== split_date() { ## Assign defaults when no variable names are given on the command line sd_1=${2:-SD_YEAR} sd_2=${3:-SD_MONTH} sd_3=${4:-SD_DAY} oldIFS=$IFS ## save current value of field separator IFS="-/. $TAB$NL" ## new value allows date to be supplied in other formats set -- $1 ## place the date into the positional parameters IFS=$oldIFS ## restore IFS [ $# -lt 3 ] && return 1 ## The date must have 3 fields ## Remove leading zeroes and assign to variables eval "$sd_1=\"${1#0}\" $sd_2=\"${2#0}\" $sd_3=\"${3#0}\"" } your Shell Scripting Recipes: 8: The Dating Game example chapter. I am just learning basics of Unix shell scripting and moving from MS Vista to Linux environment is really hard. From Vista laptop I putty Linux embedded device and get access to ASCII dumb terminal. I copy example script code c&p from Firefox MS Vista window open nano script_name application paste the code append #!/bin/sh save, close, exit nano chmod 777 ./script_name and try to run script in another terminal session. So to test and edit 10-20 example scripts takes me the whole night. Are you aware of another option to test example shell script from the net on-the-fly ? In Firefox I can run javascript / php scripts Mayby I can use Lynx. Unfortunately example shell script code doesn't come as html code to be downloaded for immediate execution. I installed basic http server. Mayby I could save example shell scripts to local http server and run them locally. Any idea ? file.plt is another scripting language I have to master, so I am looking for a working test of how to pipe Unix shell script output into gnuplot > plot "< shellscript" Tried in the night really hard and failed. Darius |
|
#4
|
|||
|
|||
|
follow-up
======= as you can see from the referenced materials, clear should clear a window or a screen Unfortunately. What I get using clear is still a tape with plotted frames Darius the issue is plot, screen clear and multiplot Info: (gnuplot) clear Info: (gnuplot) multiplot Introductory Graphing (gnuplot) multiplot 2.19.37 multiplot ----------------- The command multiplot places `gnuplot` in the multiplot mode, in which several plots are placed on the same page, window, or screen. Syntax: set multiplot unset multiplot For some terminals, no plot is displayed until the command multiplot is given, which causes the entire page to be drawn and then returns `gnuplot` to its normal single-plot mode. For other terminals, each separate `plot` command produces a plot, but the screen may not be cleared between plots. (gnuplot) clear 2.3 clear ========= The clear command erases the current screen or output device as specified by output. This usually generates a formfeed on hardcopy devices. Use terminal to set the device type.For some terminals clear erases only the portion of theplotting surface defined by size, so for these it can be usedin conjunction with multiplot to create an inset.Example: set multiplot plot sin(x) set origin 0.5,0.5 set size 0.4,0.4 clear plot cos(x) unset multiplot Please see multiplot, size, and origin fordetails of these commands. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
here is what i have tried with gnuplot: i have used the system function in C as follows: Code:
system("gnuplot.exe gnu_script");you have to include the stdlib.h file. this function calls the gnuplot.exe file and then runs the plots for gnuplot from the gnu_script file. The gnu_script file has gnu plot commands like: Code:
plot "try.dat" using 1 with lines pause -1 "Press enter for next plot" plot "try1.dat" using 2 with lines pause -1 "Press enter for next plot" plot "try2.dat" using 1 with lines pause -1 "Press enter for next plot" dunno if this may help. just an idea. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Quote:
In the meantime tested file.plt run as any another shell script with plot commands and it worked. One issue is interaction and parameters entering for interaction and animation. plot "-" command doesn't work withing .plt script ==================== ./loop3.plt plot "-" ^ "./loop3.plt", line 5: Bad data on line 1 ====================== does work as gnuplot > plot "-" ====================== 4.9 Can I put both commands and data into a single file? This is possible by the new plot "-" possibility. The plot "-" command allows to read the data to be plot from standard input or the current batch job. gnuplot> plot "-" 1 1 2 4 3 9 e |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Quote:
===================== What Wikipedia says for BATCH JOB " Batch processing is execution of a series of programs ("jobs") on a computer without human interaction. Batch jobs are set up so they can be run to completion without human interaction, so all input data is preselected through scripts or command-line parameters. This is in contrast to "online" or interactive programs which prompt the user for such input. A program takes a set of data files as input,process the data,and produces a set of output data files.This operating environment is termed as "Batch Processing" because the input data are collected into Batches on files and are processed in Batches by the program. " Ok my friends. So finally. 1.Gnuplot can read off-line data from datafile.dat, 2. Plot script can made of plot commands and run as shell script, 3. data input can be generated on-the-fly by another program/script as batch job, and shell escape command is just - plot "-" ... any data ... "e" 4. Plot file.plt can be generated on-the-fly by another program/script as batch job my question is, if commands in batch job script should be like echo "plot "-"" echo "set terminal dumb" or print "plot "-"" print "set terminal dumb" or look quite different to generate plot file file.plt ? So, as you can see. One good example can give answers to all of my questions. Example of plot script generated by another program/script as batch job, reading data input generated by one another program/script + terminal, interactive data input like plot "-" any data "e" to close data input from a command line. =============== Neo administrator, in another Makefile generated by a script... thread asked me, why my questions are so hard to understand for people " Thank you for your post, it is a bit hard for people to understand you. Could you be very specific about how we can help you, one question at a time? Thanks. " Frankly speaking, what I am looking for, is a problem solution. What Neo suggested is to ask very basic questions, one question at a time. I am sure, many experienced Shell scripters can answer either basic or more problem-oriented specific questions. As I said above, one good Gnuplot plot example showing all the features I mentioned I exactly what I am looking for. Neo asked me to make my problem-oriented specific questions as a series of very basic specific questions. I really don't know what is an idea of flooding a forum with a number of questions if one problem-oriented specific question (REQUEST FOR EXAMPLE) is all I am looking for. I can assure Neo, to ask more questions in a future. Tonight, I have to solve very basic problem and learn how to use Gnuplot. And I can assure you, that my Gnuplot problem-oriented specific question (request) is not really complicated for an experienced user of Gnuplot. As a beginner to Gnuplot I have asked very very basic question. Request for information, HowTo, HowItWorks, reference web sites is in no way any violation of Unix forum standing rules, guidelines or standards. What's more, at some Unix forums, people asking questions are requested to exactly ask one problem-oriented specific question not to flood a forum with a number of very basic questions, generating many threads. Gnuplot plot is just another scripting language. That's all. And it makes no sense to spend a week, a month on mastering some Gnuplot related stuff if one good example is all I am looking for. Already spent 2 nights visiting many Gnuplot devoted web sites. So please don't tell me that my request is a complicated one. I am asking just for one good example, nothing more and some discussion with experienced Gnuplot plot scripter. Happy New Year greetings, Darius |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script Animation | wojtyla | Shell Programming and Scripting | 2 | 04-04-2006 08:16 AM |
| script animation | debit | UNIX for Dummies Questions & Answers | 0 | 12-02-2005 12:38 AM |
| IDE controlled / RAID card issue Suse 9.2 | 98_1LE | Filesystems, Disks and Memory | 1 | 01-15-2005 07:04 PM |
| 3d animation | aloysius1001 | UNIX Desktop for Dummies Questions & Answers | 3 | 02-25-2002 03:30 PM |
| Graphics And Animation | aloysius1001 | UNIX Desktop for Dummies Questions & Answers | 5 | 02-16-2002 01:17 AM |
|
|