gnuplotの中で「ラベルで」プロットする場合はどのようにラベルを正当化することができますか?
質問
は、次の描画コマンドは、棒グラフを生成し、各バーの上値をgprintfでフォーマット、ラベルとしてプロットされています
plot "data.txt" using 6:1 index 0 notitle with boxes linestyle 1,\
"data.txt" using 6:(0.7):(gprintf("%5.2f", $1)) index 0 notitle \
with labels font "Courier,34" rotate left
私は立派に見えるのHelveticaを使用できるように右寄せする値ラベルが欲しいは、小数点以下のポイントを整列させる代わりに、クーリエフォントます。
だから、どのように私は上記のコマンドで正当性を含めることができますか?
私はgnuplotのドキュメントやWeb上のこの特定の問題については何も見つけることができませんでした。他のラベルは簡単に正当化することができますが、ラベルをプロットするとき、それはまた、可能ですか?
解決
私はあなたの特定の例をテストすることはできませんが、私はのように見えたこと鉱山を持っています:
...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels rotate left notitle
...
...ここで、「rotate left
」の部分はOPから取られました。
まあ、私は「アライメント」や、ネット上のラベルの「正当化」についてはあまり運見つけるの情報を持っていませんでした。私はオンラインgnuplotのヘルプで見てみました。基本的には、該当するものがhelp set label
の下にある - 私はそれに降り方法がわから正確ではないんだけど、ここに私のコマンドログを下回っています。
$ gnuplot ... G N U P L O T Version 4.4 patchlevel 2 ... Terminal type set to 'wxt' gnuplot> help with labels Sorry, no help for 'with labels' gnuplot> help with Functions and data may be displayed in one of a large number of styles. The `with` keyword provides the means of selection. Syntax: with { {linestyle | ls } ... where is one of lines dots steps errorbars xerrorbar xyerrorlines points impulses fsteps errorlines xerrorlines yerrorbars linespoints labels ... ... gnuplot> help labels The `labels` style reads coordinates and text from a data file and places the text string at the corresponding 2D or 3D position. 3 or 4 input columns of basic data are required. .... 3 columns: x y string # 2D version ... See also `datastrings`, `set style data`. gnuplot> help set label Arbitrary labels can be placed on the plot using the `set label` command. Syntax: set label {} {""} {at } {left | center | right} {norotate | rotate {by }} ... By default, the text is placed flush left against the point x,y,z. To adjust the way the label is positioned with respect to the point x,y,z, add the justification parameter, which may be `left`, `right` or `center`, indicating that the point is to be at the left, right or center of the text. Labels outside the plotted boundaries are permitted but may interfere with axis labels or other text. If `rotate` is given, the label is written vertically (if the terminal can do so, of course). If `rotate by ` is given, conforming terminals will try to write the text at the specified angle; non-conforming terminals will treat this as vertical text.
は、関連する部分は太字れます。しかし、そうではありません、OPの例ではrotate left
を見て、私はleft
思っrotate
の属性がある - - と彼らは私が持っていた1つの誤解を説明left
が別々の回転キーワードがある一方でrotate
は、別々の正当化パラメータである(すなわちrotate left
はしていません私が最初に考えたとして平均 "の回転反時計回りに90度の")。
それがそうであるならば、1することができますし、それら二つのキーワード反転ます:
...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels left rotate notitle
...
...とまったく同じ出力プロットを取得します。
:そして最後にあれば、私たちはのように、left
でright
を置き換えます
...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels right rotate notitle
...
...私たちはラベルがあることがわかります。のまだの(反時計回りに90度)「左」回転 - しかし、それは今の位置に右寄せです。
さて、これが役に立てば幸い、
乾杯!
他のヒント
あなたは"%5.2f"
形式を使用して、5つのスペースであることを印刷し、フィールドの幅を指定します。その消費小数部2つの空間、および小数点のための1つの空間、数の整数部分のみ2スペースを残します。あなたが指定したことを0.7
以外の数値をプロットのであれば、結果の文字列が広くなります。
また、ヘルベチカは非等幅書体であるので、数字の文字幅は同じではありません。 「0.11" とし、」0.88" は小数点整列されません