2016年11月13日 星期日

gnuplot



唸書時期畫的, 工程圖表就是用gnuplot

Gnuplot is a portable command-line driven graphing utility for Linux, OS/2, MS Windows, OSX, VMS, and many other platforms. The source code is copyrighted but freely distributed (i.e., you don't have to pay for it). It was originally created to allow scientists and students to visualize mathematical functions and data interactively, but has grown to support many non-interactive uses such as web scripting. It is also used as a plotting engine by third-party applications like Octave. Gnuplot has been supported and under active development since 1986.

    # Gnuplot script file for plotting data in file "force.dat"
      # This file is called   force.p
      set   autoscale                        # scale axes automatically
      unset log                              # remove any log-scaling
      unset label                            # remove any previous labels
      set xtic auto                          # set xtics automatically
      set ytic auto                          # set ytics automatically
      set title "Force Deflection Data for a Beam and a Column"
      set xlabel "Deflection (meters)"
      set ylabel "Force (kN)"
      set key 0.01,100
      set label "Yield Point" at 0.003,260
      set arrow from 0.0028,250 to 0.003,280
      set xr [0.0:0.022]
      set yr [0:325]
      plot    "force.dat" using 1:2 title 'Column' with linespoints , \
            "force.dat" using 1:3 title 'Beam' with points


===================

Gnuplot - for loop iteration 產生多個不同檔案
windows gnuplot產生 png


#set terminal postscript eps
#set output 'myfigure.eps'
#set term png
set autoscale
set title 'P-persistent Simulation (Channel=3)'  font ",28"       # plot title
set xlabel 'Probability' font ",16"                                  # x-axis label
set ylabel 'Throughput' font ",16"                         # y-axis label
#set yrange [0:1]
#set xrange [1:8]

set label 'ittraining' at 12,8
#N_CHANNEL,N_user,prob,total_T/MAX_N_Round);

do for [t=0:5] {
    set terminal pngcairo
    outfile = sprintf('test%03.0f.png',t)
    set output outfile
plot \
'C3U1.txt' using 3:4 w lp t "U=1",\
'C3U3.txt' using 3:4 w lp t "U=3",\
'C3U5.txt' using 3:4 w lp t "U=5",\
'C3U7.txt' using 3:4 w lp t "U=7",\
'C3U9.txt' using 3:4 w lp t "U=9",\
'C3U11.txt' using 3:4 w lp t "U=11",\
'C3U13.txt' using 3:4 w lp t "U=13",\
'C3U15.txt' using 3:4 w lp t "U=15",\
'C3U17.txt' using 3:4 w lp t "U=17",\
'C3U19.txt' using 3:4 w lp t "U=19"


}


References:

  1. https://sourceforge.net/projects/gnuplot/?source=typ_redirect
  2. DEMO Gnuplot http://gnuplot.sourceforge.net/demo/
  3. http://www.maths.manchester.ac.uk/~pjohnson/Gnuplot/windows_gnuplot.html



沒有留言 :

張貼留言