정보
-
업무명 : 그누플롯 기초 및 필수 명령어 설정
-
작성자 : 이상호
-
작성일 : 2019-08-31
-
설 명 :
-
수정이력 :
내용
[특징]
-
기상 연구 및 데이터 분석에 자주 사용되는 엑셀은 논문 및 학술지 발표의 그래프에 많은 시간이 소요
-
Gnuplot은 명령행 응용 소프트웨어로서 함수와 자료를 기반으로 그래프를 그려주는 도구
-
과학 기술 분야에서 자주 사용될 뿐만 아니라 Post Script, PNG, GIF SVG, AI 등 다양한 이미지 형식을 지원
-
특히 Post Script 출력은 매우 강력하기 때문에 Post Script을 기본적으로 지원하는 LaTeX 조화
-
더 나아가 생성된 그래프를 Adobe Illustrator 등의 벡터 드로잉 프로그램에서 편집하면 더 다양한 표현도 가능
[기능]
-
Gnuplot에 대한 기초 및 입문
-
필수 명령어 설정
[사용법]
-
소스 코드를 실행 (csh Gnuplot.csh)
-
가시화 결과를 확인
[사용 OS]
-
Linux
[사용 언어]
-
Gnuplot
-
ShellScript (csh)
소스 코드
[명세]
#!/bin/csh
#!/bin/gnuplot -persist
#*****************************************************************
# G N U P L O T *
# Version 5.0 patchlevel 0 last modified 2015-01-01 *
# *
# Copyright (C) 1986-1993, 1998, 2004, 2007-2015 *
# Thomas Williams, Colin Kelley and many others *
# *
# gnuplot home: http://www.gnuplot.info *
# faq, bugs, etc: type "help FAQ" *
# immediate help: type "help" (plot window: hit 'h') *
#*****************************************************************
#unset clip points
#set clip one
#unset clip two
#set bar 1.000000 front
#set border 31 front lt black linewidth 1.000 dashtype solid
#set zdata
#set ydata
#set xdata
#set y2data
#set x2data
#set boxwidth
#set style fill empty border
#set style rectangle back fc bgnd fillstyle solid 1.00 border lt -1
#set style circle radius graph 0.02, first 0.00000, 0.00000
#set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy
#set dummy x, y
#set format z "% h"
#set format cb "% h"
#set format r "% h"
#set timefmt "%d/%m/%y,%H:%M"
#set angles radians
#set raxis
#set style parallel front lt black linewidth 2.000 dashtype solid
#set key inside right top vertical Right noreverse enhanced autotitle nobox
#set key noinvert samplen 4 spacing 1 width 0 height 0
#set key maxcolumns 0 maxrows 0
#set style increment default
#unset logscale
#unset style line
#unset style arrow
#set style histogram clustered gap 2 title textcolor lt -1
#unset object
#set style textbox transparent margins 1.0, 1.0 border
#set offsets 0, 0, 0, 0
#set pointsize 1
#set pointintervalbox 1
#set encoding default
#unset polar
#unset parametric
#unset decimalsign
#set view 60, 30, 1, 1
#set samples 100, 100
#set isosamples 10, 10
#set surface
#unset contour
#set cntrlabel format '%8.3g' font '' start 5 interval 20
#set mapping cartesian
#set datafile separator whitespace
#unset hidden3d
#set cntrparam order 4
#set cntrparam linear
#set cntrparam levels auto 5
#set cntrparam points 5
#set style data points
#set style function lines
#unset xzeroaxis
#unset yzeroaxis
#unset zzeroaxis
#unset x2zeroaxis
#unset y2zeroaxis
#set ticslevel 0.5
#set tics scale 1, 0.5, 1, 1, 1
#set mztics default
#set mcbtics default
#set mrtics default
#set xtics border in scale 1,0.5 mirror norotate autojustify
#set xtics autofreq norangelimit
#set ytics border in scale 1,0.5 mirror norotate autojustify
#set ytics autofreq norangelimit
#set ztics border in scale 1,0.5 nomirror norotate autojustify
#set ztics autofreq norangelimit
#set cbtics border in scale 1,0.5 mirror norotate autojustify
#set cbtics autofreq norangelimit
#set rtics axis in scale 1,0.5 nomirror norotate autojustify
#set rtics autofreq norangelimit
#unset paxis 1 tics
#unset paxis 2 tics
#unset paxis 3 tics
#unset paxis 4 tics
#unset paxis 5 tics
#unset paxis 6 tics
#unset paxis 7 tics
#set timestamp bottom
#set timestamp ""
#set timestamp font "" norotate
#set rrange [ * : * ] noreverse nowriteback
#set trange [ * : * ] noreverse nowriteback
#set urange [ * : * ] noreverse nowriteback
#set vrange [ * : * ] noreverse nowriteback
#set paxis 1 range [ * : * ] noreverse nowriteback
#set paxis 2 range [ * : * ] noreverse nowriteback
#set paxis 3 range [ * : * ] noreverse nowriteback
#set paxis 4 range [ * : * ] noreverse nowriteback
#set paxis 5 range [ * : * ] noreverse nowriteback
#set paxis 6 range [ * : * ] noreverse nowriteback
#set paxis 7 range [ * : * ] noreverse nowriteback
#set zero 1e-08
#set lmargin -1
#set bmargin -1
#set rmargin -1
#set tmargin -1
#set locale "en_US.UTF-8"
#set pm3d explicit at s
#set pm3d scansautomatic
#set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
#set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
#set palette rgbformulae 7, 5, 15
#set colorbox default
#set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault
#set style boxplot candles range 1.50 outliers pt 7 separation 1 labels auto unsorted
#set loadpath
#set fontpath
#set psdir
#set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
#GNUTERM = "qt"
#ARGC = 0
#ARG0 = ""
#set zlabel "Zlabel"
#set zlabel font "Time-Roman, 18" textcolor lt -1 norotate
#set zrange [ 0 : 30 ] noreverse nowriteback
#set cblabel "Cblabel"
#set cblabel font "Time-Roman, 18" textcolor lt -1 rotate by -270
#set cbrange [ * : * ] noreverse nowriteback
gnuplot << EOF
set terminal post enhanced color font "Time-New-Roman, 18" background rgb "white"
#set terminal post enhanced color font "Helvetica, 18" background rgb "white"
#set terminal post enhanced color font "arial, 18" background rgb "white"
#set terminal post enhanced color font "sans, 18" background rgb "white"
set output "1.gif"
#set colorsequence default
#set colorsequence podo
set colorsequence classic
set grid
set style rectangle fillstyle noborder solid
set arrow from 5,0 to 5,100 nohead lt 2 lw 2
set object rectangle from 5,0 to 8,100 behind fc rgb "yellow"
#************************ Key **************************************
# set key on/off set key top left/right/center *
# set key outside set key bottom left/right/center *
# set key box set key center left/right/center *
# set key opaque/noopaque *
#*******************************************************************
set key noopaque
set key top right
#************************ Format ***********************************
# numeric timedate *
# %e(%E) : exponential %j : dat of the year(1-365) *
# %g(%G) : %f, %e(%E) %m : month(01-12) *
# %h(%H) : 10^%s %d : day of the month(01-31) *
# %x(%X) : hex %H : hour(00-23) *
# %o(%O) : octal %I : hour(01-12) *
# %f : float %p : am or pm *
# %l : log %M : minute(00-60) *
# %s : log, scientific power %s : second(00-60) *
#*******************************************************************
set format x "%2.2g" numeric
set format y "%3.3g" numeric
set format x2 "%2.2g" numeric
set format y2 "%3.3g" numeric
set title "Title"
set title font "bold, 26" textcolor rgb "#1E90FF"
set tics nomirror
set xlabel "Xlabel"
set xlabel font "bold, 18" textcolor rgb "orange" norotate
set xrange [ 1 : 10 ] noreverse nowriteback
set xtics in 0, 1, 11 font "bold, 18"
set mxtics 5
set x2label "X2lable"
set x2label font "bold, 18" textcolor rgb "orange" norotate
set x2range [ 8 : 1 ] noreverse nowriteback
set x2tics in 0, 2, 10 font "bold, 18"
set mx2tics 5
set ylabel "Ylabel"
set ylabel font "bold, 18" textcolor rgb "#32CD32" rotate by -270
set yrange [ 0 : 100 ] noreverse nowriteback
set ytics in -10, 10, 100 font "bold, 18"
set mytics 5
set y2label "Y2abel"
set y2label font "bold, 18" textcolor rgb "#32CD32" rotate by -270
set y2range [ 80 : -10 ] noreverse nowriteback
set y2tics in -10,10,100 font "bold, 18"
set my2tics 5
#************************ Fit Curve *************************
# a=1 ; b=1 *
# a2=1 ; b2=1 ; c2=1 *
# a3=1 ; b3=1 ; c3=1 ; d3=1 ; e3=1 *
# *
# f(x)=(a*x)+b *
# f2(x)=(a2*x*x)+(b2*x)+c2 *
# f3(x)=(a3*x*x*x*x)+(b3*x*x*x)+(c3*x*x)+(d3*x)+e3 *
# *
# fit f(x) "1.dat" via a,b *
# fit f2(x) "2.dat" via a2,b2,c2 *
# fit f3(x) "3.dat" via a3,b3,c3,d3,e3 *
# *
# set label sprintf("y=%.2fx+%.2f",a,b) at 8,10 *
# *
# plot [1:10] [0:100] f(x), f2(x) ,f3(x) *
#************************************************************
#********************* Multi Plot ***************************
# set size 1,1 ------------------- *
# | 0,0.5 | 0.5,0.5 | *
# set multiplot ------------------- *
# | 0,0 | 0.5,0 | *
# set size 0.5,0.5 ------------------- *
# set origin 0,0.5 *
# plot "1.dat" u 1:2 w lp lc rgb "black" t "1.dat" *
# *
# set origin 0.5,0.5 *
# plot "2.dat" u 1:2 w lp lc rgb "blue" t "2.dat" *
# *
# set size 1,0.5 *
# set origin 0,0 *
# plot "3.dat" u 1:2 axes x1y2 w lp lc rgb "red" t "3.dat" *
#************************************************************
#***************** Statistical Summary *******************************************
# * file : * Columns : *
# STATS_records STATS_skewness *
# STATS_outorange STATS_kurtosis *
# STATS_blank STATS_adev *
# STATS_blocks STATS_adev *
# STATS_columns *
# * Mean Err. : *
# * Columns : STATS_mean_err *
# STATS_min STATS_Stddev_err *
# STATS_max STATS_skewness_err *
# STATS_index_min STATS_kurtosis_err *
# STATS_index_max *
# STATS_mean * Relevant analysis of two columns *
# STATS_stddev STATS_correlation *
# STATS_ssd STATS_slope *
# STATS_lo_quartile STATS_intercept *
# STATS_median STATS_sumxy *
# STATS_up_quartile STATS_pos_min_y *
# STATS_sum STATS_pos_max_y *
# STATS_sumsq *
# STATS_slope_err *
# STATS_intercept_err *
#*********************************************************************************
# set print "fit" *
# stats [1:10] "1.dat" u 1:2 #nooutput *
# *
# set label Title = sprintf("y=%.2fx+%.2f(r=%.4f)", STATS_slope, \ *
# STATS_intercept, STATS_correlation) at 8,10 font "bold,15" *
# *
# set label Max_x = sprintf("max_x=%g", STATS_max_x) at 2,50 font "bold,15" *
# set label Min_x = sprintf("min_x=%g", STATS_min_x) at 2,55 font "bold,15" *
# set label Mean_x = sprintf("mean_x=%g", STATS_mean_x) at 2,60 font "bold,15" *
# *
# set label Max_y = sprintf("max_y=%g", STATS_max_y) at 2,65 font "bold,15" *
# set label Min_y = sprintf("min_y=%g", STATS_min_y) at 2,70 font "bold,15" *
# set label Mean_y = sprintf("mean_y=%g", STATS_mean_y) at 2,75 font "bold,15" *
# *
# plot [STATS_min_x:STATS_max_x] [STATS_min_y:STATS_max_y] \ *
# "1.dat" u 1:2 w lp t "1.dat" *
#*********************************************************************************
# smooth unique / smooth bezier / smooth csplines
a=1 ; b=1
f(x)=(a*x)+b
fit f(x) "1.dat" via a,b
#set colorsequence classic
#set colorsequence podo
plot "1.dat" u 1:2 w lp lc 1 t "1.dat" ,\
f(x) w l lc 2
#"2.dat" u 4:5 axes x2y1 w lp lc 3 t "2.dat" ,\
#"2.dat" u 4:6 axes x1y2 w lp lc 4 t "3.dat"
EOF
mogrify -rotate 90 1.gif
display 1.gif
[GitHub Gist]
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
#!/bin/csh | |
#!/bin/gnuplot -persist | |
#***************************************************************** | |
# G N U P L O T * | |
# Version 5.0 patchlevel 0 last modified 2015-01-01 * | |
# * | |
# Copyright (C) 1986-1993, 1998, 2004, 2007-2015 * | |
# Thomas Williams, Colin Kelley and many others * | |
# * | |
# gnuplot home: http://www.gnuplot.info * | |
# faq, bugs, etc: type "help FAQ" * | |
# immediate help: type "help" (plot window: hit 'h') * | |
#***************************************************************** | |
#unset clip points | |
#set clip one | |
#unset clip two | |
#set bar 1.000000 front | |
#set border 31 front lt black linewidth 1.000 dashtype solid | |
#set zdata | |
#set ydata | |
#set xdata | |
#set y2data | |
#set x2data | |
#set boxwidth | |
#set style fill empty border | |
#set style rectangle back fc bgnd fillstyle solid 1.00 border lt -1 | |
#set style circle radius graph 0.02, first 0.00000, 0.00000 | |
#set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy | |
#set dummy x, y | |
#set format z "% h" | |
#set format cb "% h" | |
#set format r "% h" | |
#set timefmt "%d/%m/%y,%H:%M" | |
#set angles radians | |
#set raxis | |
#set style parallel front lt black linewidth 2.000 dashtype solid | |
#set key inside right top vertical Right noreverse enhanced autotitle nobox | |
#set key noinvert samplen 4 spacing 1 width 0 height 0 | |
#set key maxcolumns 0 maxrows 0 | |
#set style increment default | |
#unset logscale | |
#unset style line | |
#unset style arrow | |
#set style histogram clustered gap 2 title textcolor lt -1 | |
#unset object | |
#set style textbox transparent margins 1.0, 1.0 border | |
#set offsets 0, 0, 0, 0 | |
#set pointsize 1 | |
#set pointintervalbox 1 | |
#set encoding default | |
#unset polar | |
#unset parametric | |
#unset decimalsign | |
#set view 60, 30, 1, 1 | |
#set samples 100, 100 | |
#set isosamples 10, 10 | |
#set surface | |
#unset contour | |
#set cntrlabel format '%8.3g' font '' start 5 interval 20 | |
#set mapping cartesian | |
#set datafile separator whitespace | |
#unset hidden3d | |
#set cntrparam order 4 | |
#set cntrparam linear | |
#set cntrparam levels auto 5 | |
#set cntrparam points 5 | |
#set style data points | |
#set style function lines | |
#unset xzeroaxis | |
#unset yzeroaxis | |
#unset zzeroaxis | |
#unset x2zeroaxis | |
#unset y2zeroaxis | |
#set ticslevel 0.5 | |
#set tics scale 1, 0.5, 1, 1, 1 | |
#set mztics default | |
#set mcbtics default | |
#set mrtics default | |
#set xtics border in scale 1,0.5 mirror norotate autojustify | |
#set xtics autofreq norangelimit | |
#set ytics border in scale 1,0.5 mirror norotate autojustify | |
#set ytics autofreq norangelimit | |
#set ztics border in scale 1,0.5 nomirror norotate autojustify | |
#set ztics autofreq norangelimit | |
#set cbtics border in scale 1,0.5 mirror norotate autojustify | |
#set cbtics autofreq norangelimit | |
#set rtics axis in scale 1,0.5 nomirror norotate autojustify | |
#set rtics autofreq norangelimit | |
#unset paxis 1 tics | |
#unset paxis 2 tics | |
#unset paxis 3 tics | |
#unset paxis 4 tics | |
#unset paxis 5 tics | |
#unset paxis 6 tics | |
#unset paxis 7 tics | |
#set timestamp bottom | |
#set timestamp "" | |
#set timestamp font "" norotate | |
#set rrange [ * : * ] noreverse nowriteback | |
#set trange [ * : * ] noreverse nowriteback | |
#set urange [ * : * ] noreverse nowriteback | |
#set vrange [ * : * ] noreverse nowriteback | |
#set paxis 1 range [ * : * ] noreverse nowriteback | |
#set paxis 2 range [ * : * ] noreverse nowriteback | |
#set paxis 3 range [ * : * ] noreverse nowriteback | |
#set paxis 4 range [ * : * ] noreverse nowriteback | |
#set paxis 5 range [ * : * ] noreverse nowriteback | |
#set paxis 6 range [ * : * ] noreverse nowriteback | |
#set paxis 7 range [ * : * ] noreverse nowriteback | |
#set zero 1e-08 | |
#set lmargin -1 | |
#set bmargin -1 | |
#set rmargin -1 | |
#set tmargin -1 | |
#set locale "en_US.UTF-8" | |
#set pm3d explicit at s | |
#set pm3d scansautomatic | |
#set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean | |
#set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB | |
#set palette rgbformulae 7, 5, 15 | |
#set colorbox default | |
#set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault | |
#set style boxplot candles range 1.50 outliers pt 7 separation 1 labels auto unsorted | |
#set loadpath | |
#set fontpath | |
#set psdir | |
#set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5 | |
#GNUTERM = "qt" | |
#ARGC = 0 | |
#ARG0 = "" | |
#set zlabel "Zlabel" | |
#set zlabel font "Time-Roman, 18" textcolor lt -1 norotate | |
#set zrange [ 0 : 30 ] noreverse nowriteback | |
#set cblabel "Cblabel" | |
#set cblabel font "Time-Roman, 18" textcolor lt -1 rotate by -270 | |
#set cbrange [ * : * ] noreverse nowriteback | |
gnuplot << EOF | |
set terminal post enhanced color font "Time-New-Roman, 18" background rgb "white" | |
#set terminal post enhanced color font "Helvetica, 18" background rgb "white" | |
#set terminal post enhanced color font "arial, 18" background rgb "white" | |
#set terminal post enhanced color font "sans, 18" background rgb "white" | |
set output "1.gif" | |
#set colorsequence default | |
#set colorsequence podo | |
set colorsequence classic | |
set grid | |
set style rectangle fillstyle noborder solid | |
set arrow from 5,0 to 5,100 nohead lt 2 lw 2 | |
set object rectangle from 5,0 to 8,100 behind fc rgb "yellow" | |
#************************ Key ************************************** | |
# set key on/off set key top left/right/center * | |
# set key outside set key bottom left/right/center * | |
# set key box set key center left/right/center * | |
# set key opaque/noopaque * | |
#******************************************************************* | |
set key noopaque | |
set key top right | |
#************************ Format *********************************** | |
# numeric timedate * | |
# %e(%E) : exponential %j : dat of the year(1-365) * | |
# %g(%G) : %f, %e(%E) %m : month(01-12) * | |
# %h(%H) : 10^%s %d : day of the month(01-31) * | |
# %x(%X) : hex %H : hour(00-23) * | |
# %o(%O) : octal %I : hour(01-12) * | |
# %f : float %p : am or pm * | |
# %l : log %M : minute(00-60) * | |
# %s : log, scientific power %s : second(00-60) * | |
#******************************************************************* | |
set format x "%2.2g" numeric | |
set format y "%3.3g" numeric | |
set format x2 "%2.2g" numeric | |
set format y2 "%3.3g" numeric | |
set title "Title" | |
set title font "bold, 26" textcolor rgb "#1E90FF" | |
set tics nomirror | |
set xlabel "Xlabel" | |
set xlabel font "bold, 18" textcolor rgb "orange" norotate | |
set xrange [ 1 : 10 ] noreverse nowriteback | |
set xtics in 0, 1, 11 font "bold, 18" | |
set mxtics 5 | |
set x2label "X2lable" | |
set x2label font "bold, 18" textcolor rgb "orange" norotate | |
set x2range [ 8 : 1 ] noreverse nowriteback | |
set x2tics in 0, 2, 10 font "bold, 18" | |
set mx2tics 5 | |
set ylabel "Ylabel" | |
set ylabel font "bold, 18" textcolor rgb "#32CD32" rotate by -270 | |
set yrange [ 0 : 100 ] noreverse nowriteback | |
set ytics in -10, 10, 100 font "bold, 18" | |
set mytics 5 | |
set y2label "Y2abel" | |
set y2label font "bold, 18" textcolor rgb "#32CD32" rotate by -270 | |
set y2range [ 80 : -10 ] noreverse nowriteback | |
set y2tics in -10,10,100 font "bold, 18" | |
set my2tics 5 | |
#************************ Fit Curve ************************* | |
# a=1 ; b=1 * | |
# a2=1 ; b2=1 ; c2=1 * | |
# a3=1 ; b3=1 ; c3=1 ; d3=1 ; e3=1 * | |
# * | |
# f(x)=(a*x)+b * | |
# f2(x)=(a2*x*x)+(b2*x)+c2 * | |
# f3(x)=(a3*x*x*x*x)+(b3*x*x*x)+(c3*x*x)+(d3*x)+e3 * | |
# * | |
# fit f(x) "1.dat" via a,b * | |
# fit f2(x) "2.dat" via a2,b2,c2 * | |
# fit f3(x) "3.dat" via a3,b3,c3,d3,e3 * | |
# * | |
# set label sprintf("y=%.2fx+%.2f",a,b) at 8,10 * | |
# * | |
# plot [1:10] [0:100] f(x), f2(x) ,f3(x) * | |
#************************************************************ | |
#********************* Multi Plot *************************** | |
# set size 1,1 ------------------- * | |
# | 0,0.5 | 0.5,0.5 | * | |
# set multiplot ------------------- * | |
# | 0,0 | 0.5,0 | * | |
# set size 0.5,0.5 ------------------- * | |
# set origin 0,0.5 * | |
# plot "1.dat" u 1:2 w lp lc rgb "black" t "1.dat" * | |
# * | |
# set origin 0.5,0.5 * | |
# plot "2.dat" u 1:2 w lp lc rgb "blue" t "2.dat" * | |
# * | |
# set size 1,0.5 * | |
# set origin 0,0 * | |
# plot "3.dat" u 1:2 axes x1y2 w lp lc rgb "red" t "3.dat" * | |
#************************************************************ | |
#***************** Statistical Summary ******************************************* | |
# * file : * Columns : * | |
# STATS_records STATS_skewness * | |
# STATS_outorange STATS_kurtosis * | |
# STATS_blank STATS_adev * | |
# STATS_blocks STATS_adev * | |
# STATS_columns * | |
# * Mean Err. : * | |
# * Columns : STATS_mean_err * | |
# STATS_min STATS_Stddev_err * | |
# STATS_max STATS_skewness_err * | |
# STATS_index_min STATS_kurtosis_err * | |
# STATS_index_max * | |
# STATS_mean * Relevant analysis of two columns * | |
# STATS_stddev STATS_correlation * | |
# STATS_ssd STATS_slope * | |
# STATS_lo_quartile STATS_intercept * | |
# STATS_median STATS_sumxy * | |
# STATS_up_quartile STATS_pos_min_y * | |
# STATS_sum STATS_pos_max_y * | |
# STATS_sumsq * | |
# STATS_slope_err * | |
# STATS_intercept_err * | |
#********************************************************************************* | |
# set print "fit" * | |
# stats [1:10] "1.dat" u 1:2 #nooutput * | |
# * | |
# set label Title = sprintf("y=%.2fx+%.2f(r=%.4f)", STATS_slope, \ * | |
# STATS_intercept, STATS_correlation) at 8,10 font "bold,15" * | |
# * | |
# set label Max_x = sprintf("max_x=%g", STATS_max_x) at 2,50 font "bold,15" * | |
# set label Min_x = sprintf("min_x=%g", STATS_min_x) at 2,55 font "bold,15" * | |
# set label Mean_x = sprintf("mean_x=%g", STATS_mean_x) at 2,60 font "bold,15" * | |
# * | |
# set label Max_y = sprintf("max_y=%g", STATS_max_y) at 2,65 font "bold,15" * | |
# set label Min_y = sprintf("min_y=%g", STATS_min_y) at 2,70 font "bold,15" * | |
# set label Mean_y = sprintf("mean_y=%g", STATS_mean_y) at 2,75 font "bold,15" * | |
# * | |
# plot [STATS_min_x:STATS_max_x] [STATS_min_y:STATS_max_y] \ * | |
# "1.dat" u 1:2 w lp t "1.dat" * | |
#********************************************************************************* | |
# smooth unique / smooth bezier / smooth csplines | |
a=1 ; b=1 | |
f(x)=(a*x)+b | |
fit f(x) "1.dat" via a,b | |
#set colorsequence classic | |
#set colorsequence podo | |
plot "1.dat" u 1:2 w lp lc 1 t "1.dat" ,\ | |
f(x) w l lc 2 | |
#"2.dat" u 4:5 axes x2y1 w lp lc 3 t "2.dat" ,\ | |
#"2.dat" u 4:6 axes x1y2 w lp lc 4 t "3.dat" | |
EOF | |
mogrify -rotate 90 1.gif | |
display 1.gif |
결과
[컬러 설정] set color

[그래프 선 종류] set linestyle

[글꼴 지정] set font

[회귀 모형] fit

[통계 요약] stats
-
test.dat 자료의 통계 결과를 확인할 때 stats 명령어를 사용
stats "test.dat"
-
test.dat에서 x축 (2번째 열)과 y축 (1번째 열)을 설정하여 통계 결과
stats "test.dat" using 2:1
-
stats 명령으로 생성된 변수 및 결과
stats "test.dat"
show variables
# 결과 확인
# User and default variables:
# pi = 3.14159265358979
# GNUTERM = "wxt"
# NaN = NaN
# ARGC = 0
# ARG0 = ""
# STATS_records = 100.0
# STATS_invalid = 0.0
# STATS_blank = 1.0
# STATS_blocks = 1.0
# STATS_correlation = -5.85526242668841e-018
# STATS_sumxy = -1.66533453693773e-016
# STATS_pos_min_y = -1.11111
# STATS_pos_max_y = -0.10101
-
stats 통계 변수
변수 | 내용 |
STATS_records | 범위 내의 자료 수 |
STATS_invalid | 잘못된 데이터 적절하지 않은 자료의 수 |
STATS_blank | 빈 줄 수 |
STATS_blocks | 블록 (빈 줄 두 줄로 구분된다; index로 지정할 수있다)의 수 |
STATS_outofrange | 범위를 벗어난 자료의 수 |
STATS_columns | 자료 열의 수 |
변수 | 내용 |
STATS_mean_x | x 자료의 평균 |
STATS_stddev_x | x 자료의 표준 편차 |
STATS_ssd_x | x 자료의 표본 표준 편차 (sample standard deviation; 표준 편차를 계산할 때 N으로 나누는 대신 N-1로 나눈 것) |
STATS_skewness_x | x 자료의 비대칭 (skewness) |
STATS_kurtosis_x | x 자료의 첨도 (kurtosis) |
STATS_adev_x | x 자료의 평균 편차 (average deviation; 평균과의 차이의 절대 값의 평균) |
STATS_mean_err_x | x 자료의 평균 오차 |
STATS_stddev_err_x | x 자료의 표준 편차의 오차 |
STATS_skewness_err_x | x 자료의 왜곡 정도의 오차 |
STATS_kurtosis_err_x | x 자료의 첨도의 오차 |
STATS_sum_x | x 자료의 총합 |
STATS_sumsq_x | x 자료의 제곱 합 |
STATS_min_x | x 자료의 최솟값 |
STATS_max_x | x 자료의 최댓값 |
STATS_median_x | x 자료의 평균 |
STATS_lo_quartile_x | x 자료의 아래쪽 분위 |
STATS_up_quartile_x | x 자료의 상측 분위 |
STATS_index_min_x | x 자료가 최솟값을받는 자료의 행 수 (예를 들어 10 번째 줄에 x가 최대 값을 가지고 있다면이 변수의 값은 10) |
STATS_index_max_x | x 자료의 최댓값을 받는 자료의 행 수 |
변수 | 이름 |
STATS_slope | 선형 회귀 곡선의 기울기 |
STATS_intercept | 선형 회귀 곡선의 절편 |
STATS_slope_err | 선형 회귀 곡선의 기울기 오차 |
STATS_intercept_err | 선형 회귀 곡선의 절편의 오차 |
STATS_correlation | x 와 y의 상관 계수 |
STATS_sumxy | x * y의 합 |
STATS_pos_min_y | y가 최솟값을 취할 때의 x 값 |
STATS_pos_max_y | y가 최댓값을 취할 때의 x 값 |

-
프롬프트 상에서 적용

gnuplot> plot [0:3000][] 'fort.888' u 1:(-1*$3)
gnuplot> plot [0:30][] 'fort.888' u (10000/$1):((-1*$3)*(($1**2)/10000))
참고 문헌
[논문]
- 없음
[보고서]
- 없음
[URL]
- 없음
문의사항
[기상학/프로그래밍 언어]
- sangho.lee.1990@gmail.com
[해양학/천문학/빅데이터]
- saimang0804@gmail.com
'프로그래밍 언어 > Gnuplot' 카테고리의 다른 글
[Gnuplot] 온라인/오프라인 리눅스 (Linux) 환경에 따른 그누플롯 (Gnuplot) 설치 방법 (1) | 2020.02.08 |
---|---|
[Gnuplot] 그누플롯 일사계 관측 자료를 이용한 환풍 유무에 따른 시계열 (0) | 2019.09.01 |
[Gnuplot] 그누플롯 월별 온도와 강우 변동에 따른 가시화 (0) | 2019.09.01 |
[Gnuplot] 그누플롯 기계 도면을 이용한 가시화 (0) | 2019.09.01 |
[Gnuplot] 그누플롯 RCP26 모델 결과를 이용한 시계열 (0) | 2019.08.31 |