Last active
December 21, 2015 08:02
-
-
Save Corwinpro/9ecf202cb06262537ec0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Plot refreshing data on screen | |
| set xrange [0:10] | |
| set yrange [0.8e25:3.2e25] | |
| unset autoscale | |
| do for [i=1:4000] { plot sprintf('field_%d0.txt',i) u ($0/100):1 w lp pt 6; pause 0.05; set title sprintf('Time: %.1e',i*1.e-11)} | |
| //Make video file | |
| =====loop.plt===== | |
| j = i*5 //need to make 1,2,3...-like png files | |
| filename = "field_".j.".txt" | |
| plotfile = "field".i.".png" // plotfile = "dens".i.".png" | |
| print filename." ".plotfile | |
| set output plotfile | |
| plot filename using ($0/100):4 w l title "I1"; set title sprintf('Time: %.1e sec',i*0.5e-11) | |
| // OR | |
| // plot filename using ($0/100):1 w l title "density"; set title sprintf('Time: %.1e sec',i*0.5e-11) | |
| set output | |
| i=i+1 | |
| if (i <= n) reread | |
| ====in gnuplot==== | |
| i = 1 | |
| n = 620 | |
| set terminal pngcairo | |
| set yrange[8.96e9:8.972e9] //if u 0:4 - for field | |
| set yrange[2e24:5.1e25] // if u 0:1 - for density | |
| load "loop.plt" | |
| =====video.sh===== | |
| ffmpeg -f image2 -i field%d.png field.mpg //for field | |
| ffmpeg -f image2 -i dens%d.png dens.mpg //for dens | |
| ++++++++++++++++++++++++++TWO Y AXIS++++++++++++++++++++++++++++++++++++ | |
| set ytics nomirror | |
| set y2tics | |
| set link y2 via y/3.7e-5 inverse y*3.7e-5 | |
| set xrange[0:1.5e-9] | |
| set yrange[0:4.25e-5] | |
| set xlabel 'Time' | |
| set ylabel '{/Symbol_D} n_a' | |
| set y2label '%' | |
| set xlabel font "Verdana,15" | |
| set ylabel font "Verdana,15" | |
| set y2label font "Verdana,15" | |
| plot 'ampl_phase_1.txt' u ($0*1.e-12):($2*2.88/8.85/2.e28) w l lw 2 title 'Smile data', 'data_shn.txt' u 1:($2) w l lw 2 title 'Shneider data' | |
| +++++++++++++++AVERAGE EVERY 10 POINTS+++++++++++++++++++++++++++ | |
| http://gnuplot.sourceforge.net/demo/running_avg.html | |
| samples(x) = $0 > 9 ? 10 : ($0+1) | |
| avg10(x) = (shift10(x), (back1+back2+back3+back4+back5+back6+back7+back8+back9+back10)/samples($0)) | |
| shift10(x) = (back10 = back9,back9 = back8, back8 = back7, back7 = back6, back6 = back5, back5 = back4, back4 = back3, back3 = back2, back2 = back1, back1 = x) | |
| datafile = "data.dat" | |
| init(x) = (back1 = back2 = back3 = back4 = back5 = back6 = back7 = back8 = back9 = back10 = sum = 0) | |
| plot sum = init(0), \ | |
| datafile using 0:1 title 'data' lw 2 lc rgb 'forest-green', \ | |
| '' using 0:(avg10($1)) title "running mean over previous 10 points" pt 7 ps 0.5 lw 1 lc rgb "blue" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment