Ȼ/12

Top / Ȼ / 12

gnuplot

gnuplot ȤϡŪˤŪˤѤ뤳Ȥν롤CUI ̤ͳպġǤ*1 ɤ餫Ȥȥץꥱޥɥ饤󤫤ؼФ뤿ᵡṲ̄˥դݤʤɤϥѥפδ֤˶ॳޥѤ뤳ȤǽǤ롥 ħȤƤϡ



  • ̤˻Ȥˤ CUI Ƥ򥳥ޥɤǻؼΤ
  • ޥɤȤƤȤ롥
  • Ǥ뤳Ȥϡˡȡ򥰥դˤ뤳Ȥȡǡ򥰥դˤ뤳ȡ
  • Postscript SVG ǽϤǤ롥ϥդ٥ǽϤǤ뤳Ȥ̣롥
  • TeX ɤTeX Ѥü򤹤뤳Ȥǽ*2

ȤȤ󤲤롥



Reference: ͻ


  • JNorth_arrow-right-sm.png gnuplot gnuplot ܲ web. ǿǤɥȤ⤳ˤ롥ǿСϸǤ 5.0 cvs. 󥯤éäƹԤȡWindows Ѥ֤Ƥ롥2014ǯ715ǤǿΤ褦 ʤʤ褦˲ʤƤΤǡ󥹥ȡ뤹ʤкǿǤˤۤäȹǤ롥





¾ˤ⡤web ˤ gnuplot ˤĤƽ񤤤Τ䡤Ҥ롥 ʬˤäΤõƤߤ褦 ʤߤˡgnuplot ˴ؤܸҤϴʤΤǡäƤ餤ɬפ*3.



101 of gnuplot:

Ability: ʤˤΤ

ܲ web demo gallery إɤΤ褦ʤȤΤäȸƤ ʸɤޤˤäȿޤ򸫤Ǥ⡤뤫褽İǤȻפ

begin, end and help: ưλإ

  • gnuplot ưˤϡޥɥ饤

    gnuplot

    Ϥɤ gnuplot ươޥɼե⡼ɤˤʤ(ץץȤѤΤǤ狼)
  • gnuplot λˤϡgnuplot ΥޥɤȤ

    exit

    quit

    Ǥ褤
  • gnuplot Υإפϡgnuplot ưƤ顤CUI ʤ餽ΥޥɤȤ

    help

    ?

    Ȥ롥 GUI ץꥱȤƼΤäƤʤХإץܥ󤬤餽򲡤Ƥɤ
    ˤƤإפ¿ع¤ˤʤäƤƤäɤߤˤΤǡܲ web ޥ˥奢ɤɤɤ(ޥ˥奢̤κɤߤ䤹)

The easiest example: ñ

ʲΤ褦ˤơޤϻƤߤ褦



notes.png ½: ʲμ˽ gnuplot ưƤߤ롥

  1. ޤgnuplot ư롥

  2. ˡgnuplot ǼΥޥɤԤǤ⤦

    set␣samples␣300

    plot␣[-30:30]␣sin(x)/x

    set␣term␣png

    set␣output␣"sample-01.png"

    replot

    exit



  3. ꤬ʤСsample-01.png Ȥ,
    gnuplot-sample.png
    ե뤬ǤƤΤǡƤߤ褦. (綵ѥƥबġɤꤷƤ뤫ʤΤ) GUIǤΥեޥǥ֥륯åΤ

Plot of functions: ȡ

㤫狼褦ˡgnuplot plot ޥɤͿȡ򤽤ΤޤޥդȤǤ롥 ȡϴͿƤ(help␣functions Ǹ뤳Ȥ)¾ˡʬǤ뤳ȤǤ롥
㤨С

f(x)=x*x+2*x+1

Ȥȡ f(x) Ȥ x^2+2x+1 Ȥˤʤꡤ

plot␣f(x)

ȤФ¿༰ΥդȤ롥

Options for function plot: ȡΥץ

plot Фơ٤ѤȤϼΤ褦ˤФ褤.



  • ⤦(Ʊؿ).

    replot

    Ȥ, ǤǶ plot splot() Ƽ¹Ԥ.

  • դѤ.
    gnuplot ˴ؿ̾ʬǷҤ뤬ɽʤɤϼΤ褦ˤФ褤*4.

    plot␣sin(x)␣with␣points

    with ³ƻȤ륪ץˤ points ¾ lines, linespoints, impulses, steps, dots, boxes ʤɤ.

  • 褹ϰϤѤ.

    plot␣[-3:3]␣[-1.2:2.0]␣sin(x)

    ȤФ褤. ܤ [a:b] xϰϤɽܤ yϰϤɽ.

  • ɽ˻Ȥפο䤷.
    פοʤƥդƤʤäơɽʤȤ褦ʾϡ plot

    set␣samples␣Ȥ

    ϤƤɤ.

  • İʾδؿƱɽ.

    plot␣sin(x),␣cos(x)

    ʤɤ ,() Ƕڤäƽ񤯤ɤ.



notes.png ½: ͡ʥץƤߤ褦

Plot of 3D functions: 3դȡ

ˡsplot ȤޥɤȤ3դȤ롥 㤨 gnuplot

splot␣x**2+y**2

ȤƤߤ褦 ˡФƤդޥϤưƤߤ褦 ͡ʻ3դͳ˸뤳ȤϤ

Options for 3D function plot: 3D ȡΥץ

splot Фơ٤ѤȤϼΤ褦ˤФ褤.



  • 褹ϰϤѤ.

    plot␣[-3:3]␣[-1.2:2.0]␣[-2:3]␣x**2+y**2

    ȤФ褤. ܤ [a:b] xϰϤɽܤ yϰϤ, ܤ z(⤵)ϰϤɽ.

  • ɽ˻Ȥפο䤷.
    פοʤƥդƤʤäơɽʤȤ褦ʾϡ splot

    set␣isosamples␣Ȥ

    Ȥɤ. ŤʤΤǡޤ礭ʿͿʤ褦ˡ

  • ɽ.
    splot

    set␣contour

    set␣contour␣both

    ϤƤФ褤. both Ĥʤ̤ˤΤޤ졤 both Ĥɽˤ.

    unset␣contour

    ȤСʹߤʤ.

  • ̽򤷤.

    set␣hidden3d

    ȤƤ splot ȱ̽Ԥʤ.

    unset␣hidden3d

    Ȥб̵̽ˤʤ.

  • Ѥ.

    set␣view␣45,␣80,␣0.8

    ʤɤȤƤ splot ȡꤷȽ̼ܤ3դ. ǽ 45 z(⤵)Ȼγ٤ 80 Ͼ夫鸫Ȥ xȻγ٤ Ǹ 0.8 ϥդι⤵Υɽ.

  • ⤵˿դƸ.

    set␣pm3d

    ȤƤ splot ȹ⤵˱̤ɤäƤ롥 ϽŤʤ롥

    unset␣pm3d

    Ȥи롥



notes.png ½: ͡ʥץƤߤ褦

Plot of data: ǡ򥰥դ

ȡǤʤǡ򥰥դˤ뤳Ȥ롥 Τ褦ˤƳΤƤߤ褦



notes.png ½: λؼ˽äƻƤߤ褦

  1. ƥȥǥǡƤĥե롥 ե̾ dummy.dat ȤƤ
       1   1.0
       2   4.0
       3   9.2
       5   8.3


  2. gnuplot ư

  3. gnuplot ǡ

    plot␣"dummy.dat"

    ȤƤߤ롥 4ĤǤ줿դϤ
    ȸˤʤȤ

    plot␣"dummy.dat"␣w␣l

    ȤСǡҤդˤʤ뤷

    plot␣"dummy.dat"␣w␣lp

    ȤХǡǤ롥



notes.png ½: ʬŬʥǡեΥǡͥղƤߤ.

Save graph files: դե¸

줿ե˽ϤȤȤϡ

  1. ¸ꤹ.
  2. ¸ե̾ꤹ.
  3. ⤦ٲ
  4. ȥե֥̾ꥻåȡפ. ꥻåȤʤȡ˲Ȥư狼ʤʤ.


Ȥ礬ɬפǤ.

ǰʤȤˡŪˤƤ򤿤˥ե¸뵡ǽ¸ߤʤΤǡμ򤷤褦

warning.png (ʤȤ windows Ѥ) gnuplot ver. 5.0 ϲɽ terminal qt Ȥʤ(ޤǤ wxt), Ƥ륰դ򤽤Τޤ pdf, svg, (png ⤷ bmp) ǥݡȤ뵡ǽĤ褦 Ūˤϡɽ̤κ˰/ݡȥܥ󤬤Ĥ ˸Ƥ ver. 5.0rc1 Ǥ⤽εǽϼƤΤǡ(windows ѼԤ?) gnuplot ǿǤˤȾˤʤ
gnuplot-5.0rc1-window-export-sample.png
gnuplot 5.0rc1 DzݡȵǽȤȤͻ

How to set "file format": λȥꥻåȤˡ

ޤ¸ηꤹɬפ. ΰ٤ˤϡgnuplot

set␣terminal␣␣ץ

Ȥƻꤹ*5.
png EPS ˤĤƴñ˥ꥹȥåפƤ

λȥꥻåȤ

ޥȤ߹碌
pngset␣terminal␣png
Postscriptset␣terminal␣postscript␣eps␣22
ꥻå (unix ξ)set␣terminal␣x11
ꥻå (windows ξ)set␣terminal␣wxt
set␣terminal␣qt (ver 5.0ʹ)

set␣terminal␣windows



ʤߤˡ¾ΤäƤʥեˤ

  • canvas (html5 )
  • dumb (ʸü)
  • epslatex (eps ʸ tex )
  • latex
  • pdf
  • svg (٥ȥ)
    ʤɤ롥

How to set "file name": ե̾λȥꥻåȤˡ

¸Υե̾ꤹɬפ. ΰ٤ˤϡgnuplot

set␣output␣ե̾

Ȥƻꤹ롥

ե̾ΥꥻåȤˤϡ

unset␣output

ȤФ褤

... What?: ɤɤɤΤ

褯ʬ ȤԤ¿顤unix Ǥ򤢤Ƥ(Windows ξϲ x11 Ȥʬ wxt (ver.5.0ʹߤǤ qt)ȤƤФ褤). Ƥޤե¸ȤϤȤˤΤ褦ˤФ褤

դե벽륳ޥȤ߹碌

ޥ(֤˼¹Ԥ)
png
set␣terminal␣png␣color
set␣output␣'hoge.png'
replot
set␣terminal␣x11
unset␣output
Postscript
set␣terminal␣postscript␣eps␣22
set␣output␣'hoge.eps'
replot
set␣terminal␣x11
unset␣output



notes.png ½: Ŭʥդꡤpng postscript ¸褦

How to use the gnuplot as a command: Ū gnuplot Ȥ

gnuplot Ū˻Ȥ(ޥɤȤƻȤ)Τϴñ ŪϤΤƱƤե˽񤤤ƤƤΥե̾򥳥ޥɤΥץȤͿФ褤 ⤷Ϳ륳ޥɤʤɤûʤХץľͿƤɤ

狼䤹½̤ƻƤߤ褦



notes.png ½:

  1. ޤե̿񤤤ƤƤΥեꤹˡƤߤ褦 sin2png.gpl Ȥ̾ΥեꡤʲƤ񤭹ࡥ
     set term png
     set output "f_sin.png"
     plot sin(x)**2


  2. Υե뤬ǥ쥯ȥˤơ

    gnuplot␣"sin2png.gpl"

    Ȥ gnuplot 򥳥ޥɤȤƻȤ Τ褦˻ؼͿȡgnuplot ϥޥŪ˰롥

  3. ꤬ʤСf_sin.png Ȥե뤬ǤƤΤǡƤߤ褦.

    εǽΤǡ륹ץȤʤɤ gnuplot ƤӽФƵŪ˥ղե뤳ȤñˤǤ롥

  4. ˡ̿ľܥץȤͿˡƤߤ褦 ɤΥǥ쥯ȥ꤫ǤɤΤǡ

    gnuplot␣-e␣"set␣term␣dumb;␣plot␣sin(x)"

    ȥޥɥ饤󤫤̿ᤷƤߤ褦 ⤷ "-e" ץդʤ餤Ť gnuplot ȤΤǤС

    echo "set␣term␣dumb;␣plot␣sin(x)"␣|␣gnuplot␣-

    ȤƱͤư(ǸΥϥե˺ʤ褦ˤ褦)

    ơΤ褦ˡû̿ǤľͿƤޤФʤˤȤ狼䤹ưˤɤ



Report: ݡ

ʲβˤĤǽ¤긭ĴȹͻԤ
AppliedMath7-Report-12
Ȥ̾Ĥ e-mail ˤƶ˥ݡȤȤФ. ʤݡȤ e-mail TeX Ǻ̤ˤФƤ褤.

Exercises:

  1. sin(x), sin(x+0.1), ... sin(x+1.0) 11ĤȡդƱդҤȤĺ롥 ˡ򾯤餷 sin(x+0.1), ... sin(x+1.0), sin(x+1.1) 11ĤδؿդƱͤƱդҤȤĺ롥 򷫤֤ sin(x+1.0), ... sin(x+1.9), sin(x+2.0) 11ĤδؿդƱͤƱդҤȤĺȤޤǤ롥 ΰϢκȤʤ٤ڤˤˤϤɤ褤ͤ补

  2. Ƥ gnuplot ѤƤ롥 ѤˤĤƲ⤻补

  3. ٤ġ륹ץȤ̤ gnuplot ƤӽФƥղե餻ƤȤ褵ͤ补



about Icons, ClipArts

For details, see JNorth_arrow-right-sm.png this.


*1 1986ˤϴ¸ߤϤ
*2 ̤ Postscript Ȥäۤľǰ䤹TeX Υɤǿޤ񤭤ʤɤˤϤȤƤ
*3 ʤɬפʤȤˤǤ뤳ɬǤ
*4 with points ȿܤ˽񤫤ˡ w p ȤǤɤ
*5 Ȥȥץ¿Τǡإפȥޥ˥奢ǧƤ