モニタモードダイアグラムをプロットするには、gnuplot パッケージ(UNIX
のようなオペレーティングシステム用のフリーウェアのプロット言語)と
コマンドラインから入力したモニタの特性から gnuplot で ダイアグラムを
プロットする shell スクリプトである modeplot ツールが必要です。
modeplot のリストを示します:
#!/bin/sh
#
# modeplot -- generate X mode plot of available monitor modes
#
# Do `modeplot -?' to see the control options.
#
# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz
# and vertical frequencies in Hz.
TITLE="Viewsonic 21PS"
BANDWIDTH=185
MINHSF=31
MAXHSF=85
MINVSF=50
MAXVSF=160
ASPECT="4/3"
vesa=72.5       # VESA-recommended minimum refresh rate
while [ "$1" != "" ] 
do
        case $1 in
        -t) TITLE="$2"; shift;; 
        -b) BANDWIDTH="$2"; shift;; 
        -h) MINHSF="$2" MAXHSF="$3"; shift; shift;; 
        -v) MINVSF="$2" MAXVSF="$3"; shift; shift;; 
        -a) ASPECT="$2"; shift;; 
        -g) GNUOPTS="$2"; shift;; 
        -?) cat <<EOF
modeplot control switches:
-t "<description>"   name of monitor            defaults to "Viewsonic 21PS"
-b <nn>              bandwidth in MHz           defaults to 185
-h <min> <max>    min & max HSF (kHz)        defaults to 31 85
-v <min> <max>    min & max VSF (Hz)         defaults to 50 160
-a <aspect ratio>    aspect ratio               defaults to 4/3
-g "<options>"       pass options to gnuplot
The -b, -h and -v options are required, -a, -t, -g optional.  You can
use -g to pass a device type to gnuplot so that (for example) modeplot's
output can be redirected to a printer.  See gnuplot(1) for  details.
The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on
analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de>
This is modeplot $Revision: 1.7 $
EOF
                exit;;
        esac
        shift
done
gnuplot $GNUOPTS <<EOF
set title "$TITLE Mode Plot"
# Magic numbers.  Unfortunately, the plot is quite sensitive to changes in
# these, and they may fail to represent reality on some monitors.  We need
# to fix values to get even an approximation of the mode diagram.  These come
# from looking at lots of values in the ModeDB database.
F1 = 1.30       # multiplier to convert horizontal resolution to frame width
F2 = 1.05       # multiplier to convert vertical resolution to frame height
# Function definitions (multiplication by 1.0 forces real-number arithmetic)
ac = (1.0*$ASPECT)*F1/F2
refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf)
dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr)
resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2)
# Put labels on the axes
set xlabel 'DCF (MHz)'
set ylabel 'RR (Hz)' 6  # Put it right over the Y axis
# Generate diagram
set grid
set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left
set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead
set label "max VSF" at 1, $MAXVSF-1.5
set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead
set label "min VSF" at 1, $MINVSF-1.5
set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead
set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right
set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right
set label "VESA $vesa" at 1, $vesa-1.5
set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1
plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \
  refresh($MINHSF, dcf) notitle with lines 1, \
  refresh($MAXHSF, dcf) notitle with lines 1, \
  resolution(640*480,   dcf) title "640x480  " with points 2, \
  resolution(800*600,   dcf) title "800x600  " with points 3, \
  resolution(1024*768,  dcf) title "1024x768 " with points 4, \
  resolution(1280*1024, dcf) title "1280x1024" with points 5, \
  resolution(1600*1280, dcf) title "1600x1200" with points 6
pause 9999
EOF
modeplot を持っていることと gnuplot パッケージがある場所を
確認したら、次に述べるモニタの特性値が必要です:
プロットプログラムは、必ずしも正確とは限らない簡素化のための幾つかの仮説を 必要とします。得られたダイアグラムが大まかな記述しかないのはこのためです。 これらの仮定とは:
modeplot 
プログラムは標準で 4/3 を仮定していますが、変更可能です。
        HFL = F1 * HR
        VFL = F2 * VR
大まかな規準として、F1 = 1.30 と F2 = 1.05 としてください ( "フレームサイズの計算"を参照してください)。
さて、ある特定の同期周波数すなわち HSF を取り上げてみます。現在の仮定 では、それぞれのドットクロック DCF の値が既にリフレッシュレート RR を 決定しています。すなわち、HSF の全ての値に対して、関数 RR(DCF)が存在す るということです。これば次のようにして得られます。
リフレッシュレートはフレームサイズの積でドットクロックを割ったものです:
        RR = DCF / (HFL * VFL)          (*)
一方、水平フレーム長はドットクロックを水平同期周波数で割ったものに等しくなり ます:
        HFL = DCF / HSF                 (**)
前述の 2 つの仮定に基づけば、VFL の値は HFL の値まで減らせます:
        VFL = F2 * VR
            = F2 * (HR / AR)
            = (F2/F1) * HFL / AR        (***)
(**) と (***) を (*) に代入すると以下の結果が得られます:
        RR = DCF / ((F2/F1) * HFL**2 / AR)
           = (F1/F2) * AR * DCF * (HSF/DCF)**2
           = (F1/F2) * AR * HSF**2 / DCF
HSF, F1, F2 と AR を固定すると、ダイアグラムは双曲線になります。この曲線 の中の最小と最大の水平同期周波数で許容領域の残りの境界線が得られます。
特性領域と直線の交線が特定の解像度を表します。これは (*) 式と 2 番目の仮定に基づきます:
        RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR)
使いたい全ての解像度でこのような線を描くことによって、解像度、 クロック周波数とモニタがサポートできるリフレッシュレートの間に関係があ るだろうということがすぐにわかります。これらの線はモニタの特性には依存 していませんが、2 つ目の仮定には依存しています。
modeplot ツールはこの作業を簡単にします。modeplot -? 
と入力して制御オプションを見てください。典型的な実行形式は以下のように
なります:
        modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58
-b オプションはビデオの帯域幅を指定します。-v と -h は水平と垂直同期 周波数の範囲を指定します。
modeplot の出力を読むときは、近似表現のみであることを常に
覚えておいてください。例えば、最小同期信号幅から得られた HFL の上限を
無視しますし、仮定が正しい限りにおいてしか正確ではありません。従って
全体のまとめ
に示してある(いくつかの黒魔術を含んだ)詳細な計算式の代わりにはなりません。
しかしながら、何が可能であるか、あるいはどんなトレードオフがあるかにつ
いてはすっきりするはずです。