Theory of Horology

Theory of Horology


4-2 Sample Program on "Gnuplot"

4-2-4 Drawing of Outer Terminal Curve (an example) of Hairspring


# setting the aspect ratio of graph
set size ratio 1

# setting the numbers of sample
set samples 100000

# setting the grid
set grid

# setting the kinds of lines of graph
set style line 1 linetype 1
set style line 1 linecolor 3
set style line 1 linewidth 2

set style line 2 linetype 1
set style line 2 linecolor 1
set style line 2 linewidth 2

set style line 3 linetype 1
set style line 3 linecolor -1
set style line 3 linewidth 1

# setting the y-range of graph
set yrange[-1.5:1.5]

# setting the label of x and y axes
set xlabel "{/=26 {x/r}{/=16 {1}}"
set ylabel "{/=26 {y/r}{/=16 {1}}"

# graphing
plot [-1.5:1.5] dummy=0,\
[-1.5:1.5] sqrt(0.8365**2-(x-0.1635)**2) \
w l linestyle 1 title "r=0.8365",\
[-1.5:-0.0795]-sqrt(0.673**2-x**2) \
w l linestyle 2 title "r=0.673",\
[-1.5:1.5] sqrt(1-x**2) w l linestyle 3 notitle,\
[-1.5:1.5] -sqrt(1-x**2) w l linestyle 3 notitle,\
[-1.5:1.5] 0 w l linestyle 3 notitle

# designating the output format and option
set terminal jpeg

# designating the output file name
set output "outer-terminal-sample.jpeg"

# regraphing
replot

# resetting the format and output
set output
set terminal win
[EOF]

The execution result can be obtained as shown in the figure below.