|
From: ifryd <if...@o2...> - 2008-03-05 11:13:30
|
Hi, I almost finished my master degree work but I have some problems using GNUPLOT script dedicated for almost real plotting on screen Wink Not so long time ago I posted this thread about visualisation data on screen: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=56718&highlight= My previous post about plotting data on the screen Thanks to gintaras_bar from AVR_freaks forum I received really nice script for plotting in real time. I tried to change it and adjust it to my needs but actually it is hard to scroll nicly the screen in desired speed. Additionaly some undesired plots occur which are not connected with the samples. Below I am enclosing these scripts: plot_log_file.bat: REM batch file for starting data plot, from log file "C:\Program Files\gnuplot422\bin\pgnuplot" init_plot.gnp script file for gnuplot initialization init_plot.gnp: #### gnuplot script, which is initializing plotting process #### # # this variable holds value how many lines are used to plot data already processed_lines=0 # this constant defines how many lines_from_the_end_of_file to plot (change according to your needs) lines_from_the_end_of_file=3000 # this constant defines how many new data lines are received every second (change according to your needs) lines_per_second_received=1 # log file to be plotted file2plot='com_port.log' # how data should look on a screen set style data lines # call script, which does real time plotting call 'real_time_plot.gnp' and my script file which runs real time plot real_time_plot.gnp: # #### gnuplot script, which is plotting in the real time (well, almost :) ) #### # # this part expects one column of data per line (row) and is # plotting lines_from_the_end_of_file if started together with logging process. # If started later, when file is bigger than lines_from_the_end_of_file, # it is plotting more lines. # if (processed_lines<lines_from_the_end_of_file) plot file2plot; else plot file2plot every ::processed_lines-lines_from_the_end_of_file # if you need whole file to be plotted #plot file2plot # if you need more columns (series) to plot #plot file2plot using 1 title 'Col1', file2plot using 2 title 'Col2' set tmargin 0 set bmargin 0 set lmargin 3 set rmargin 3 unset xtics set multiplot set origin 0,0.85 set size 1,0.15 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 1; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 1 # plot file2plot using 1 set origin 0,0.7 set size 1,0.15 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 2; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 2 #plot file2plot using 2 set origin 0,0.65 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 3; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 3 #plot file2plot using 3 set origin 0,0.60 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 4; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 4 #plot file2plot using 4 set origin 0,0.55 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 5; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 5 #plot file2plot using 5 set origin 0,0.50 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 6; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 6 #plot file2plot using 6 set origin 0,0.45 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 7; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 7 #plot file2plot using 7 set origin 0,0.40 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 8; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 8 #plot file2plot using 8 set origin 0,0.35 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 9; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 9 #plot file2plot using 9 set origin 0,0.30 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 10; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 10 #plot file2plot using 10 set origin 0,0.25 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 11; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 11 #plot file2plot using 11 set origin 0,0.20 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 12; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 12 #plot file2plot using 12 set origin 0,0.15 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 13; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 13 #plot file2plot using 13 set origin 0,0.10 set size 1,0.05 if (processed_lines<lines_from_the_end_of_file) plot file2plot using 14; else plot file2plot every ::processed_lines-lines_from_the_end_of_file using 14 plot file2plot using 14 # update variables processed_lines=processed_lines+lines_per_second_received # rest for 1 second pause 1 # repeat plotting process reread One thing wich I cannot figure out is how many lines I am sending to the PC via USART. Maybe there is a way in a GNUPLOT script to plot the data from the file like 1/4 from the end of file ?? That would be the best in this case. Anyway below I am enclosing a picture of the plot which I would like to obtain http://www.nabble.com/file/p15839729/plot.png Additionally, maybe you have other methods for visualization. I would like to scrool screen to see all signals. I also posted this thread on: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=417656#417656 the same post on www.avrfreaks.net Thanks in advance for various solutions and your help Adam - if...@o2... -- View this message in context: http://www.nabble.com/GNUPLOT-script---plotting-data-in-real-time-with-scrolling-tp15839729p15839729.html Sent from the Gnuplot - Dev mailing list archive at Nabble.com. |