質問

私はこのファイルとして data.dat:

Xstep Y1 Y2 Y3 Y4
332 1.22 0.00 0.00 1.43
336 5.95 12.03 6.11 10.41
340 81.05 81.82 81.92 81.05
394 11.76 6.16 10.46 5.87
398 0.00 0.00 1.51 1.25
1036 0.03 0.00 0.00 0.00

できるこのプロットデータとしてのヒストグラムこのスクリプト hist-v1.gplot (使用 set style data histogram):

set xlabel "X values"
set ylabel "Occurence"
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set term png
set output 'hist-v1.png'
set boxwidth 0.9
# attempt to set xtics so they are positioned numerically on x axis:
set xtics ("332" 332, "336" 336, "340" 340, "394" 394, "398" 398, "1036" 1036)  
# ti col reads the first entry of the column, uses it as title name 
plot 'data.dat' using 2:xtic(1) ti col,  '' u 3 ti col, '' u 4 ti col, '' u 5 ti col

との呼び出:

gnuplot hist-v1.gplot && eog hist-v1.png

このイメージの生成:image hist-v1.png

ただし、通知のX軸のスケーリングは行われません数値で理解でのXの値として分類(このカテゴリ軸)。

いきなりの数値をX軸のスクリプト hist-v2.gplot (使用 with boxes):

set xlabel "X values"
set ylabel "Occurence"
# in this case, histogram commands have no effect
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set term png
set output 'hist-v2.png'
set boxwidth 0.9
set xr [330:400]
# here, setting xtics makes them positioned numerically on x axis:
set xtics ("332" 332, "336" 336, "340" 340, "394" 394, "398" 398, "1036" 1036)  
# 1:2 will ONLY work with proper xr; since we have x>300; xr[0:10] generates "points y value undefined"!
plot 'data.dat' using 1:2 ti col smooth frequency with boxes, '' u 1:3 ti col smooth frequency with boxes

との呼び出:

gnuplot hist-v2.gplot && eog hist-v2.png

このイメージの生成:画像hist-.phpがv2で増えたファイルです。png http://img266.imageshack.us/img266/6717/histv2.png

残念ながら、バー'重複はこちらではのグラフで表示します。

あいち早く入手することができ、数値的規模でのX軸にして hist-v2.png,さま、ありがとうございました、"バー側として hist-v1.png?このスレッド"Re:ヒストグラムのx軸の日のエラー"とはできません:

が難しいものの引きのx座標(ワールド座標系日のデータファイル...

それとは異なる問題...

おかげさ

感謝!

役に立ちましたか?

解決

Okを読んで gnuplot ヘルメンバーが、このヒストグラムスタイルは"常に"解釈のx軸として逐次応募/カテゴリ-であいによる数値軸とヒストグラムです。

しかし、ここで示されているデータ $ を参照することができるカラムは、使用でき、実際に'の位置づけのバーのfrequency with boxes スタイル)、なのでこのコードとして hist-v2b.gplot:

set xlabel "X values"
set ylabel "Occurence"
set style fill solid border -1
set term png
set output 'hist-v2.png'
set boxwidth 0.9
set xr [330:400]
# here, setting xtics makes them positioned numerically on x axis:
set xtics ("332" 332, "336" 336, "340" 340, "394" 394, "398" 398, "1036" 1036)  
# 1:2 will ONLY work with proper xr; since we have x>300; xr[0:10] generates "points y value undefined"!
plot 'data.dat' using ($1-0.5):2 ti col smooth frequency with boxes, '' u ($1-0.25):3 ti col smooth frequency with boxes, '' u ($1+0.25):4 ti col smooth frequency with boxes, '' u ($1+0.5):5 ti col smooth frequency with boxes

との呼び出:

gnuplot hist-v2b.gplot && eog hist-v2b.png

このイメージの生成:画像hist-v2b.png http://img823.imageshack.us/img823/805/histv2b.png

...ですが、ここでは何をしたかった。

ほんの一部でご注意いものを使いたいというスクリプトをインラインデータのための設定をこのように、これまでに書き込まれるとして

plot '-' using ($1-0.5):2 ti col smooth frequency with boxes, '-' u ($1-0.25):3 ti col smooth frequency with boxes
Xstep Y1 Y2 Y3 Y4
332 1.22 0.00 0.00 1.43
336 5.95 12.03 6.11 10.41
340 81.05 81.82 81.92 81.05
394 11.76 6.16 10.46 5.87
398 0.00 0.00 1.51 1.25
1036 0.03 0.00 0.00 0.00
end
Xstep Y1 Y2 Y3 Y4
332 1.22 0.00 0.00 1.43
336 5.95 12.03 6.11 10.41
340 81.05 81.82 81.92 81.05
394 11.76 6.16 10.46 5.87
398 0.00 0.00 1.51 1.25
1036 0.03 0.00 0.00 0.00
end

...このデータが入力であった複数の日常化していることを考えると、であることからstdin-この問題に集中講義として行っています。 gnuplotい複数のプロットからデータファイルを内蔵したコマンド.

感謝!

PS:としてはかなりのビットスペース図、コミュニケーションを取り合いかを指定し別のx軸の範囲この集中講義として行っています。:

他のヒント

あなたは「ボックス」のプロットスタイルを使用してヒストグラムをプロットするとき、

は正しくボックスの幅を設定することは非常に重要です。私のブログの記事の一つで、私はそれについて話をしています。興味場合は、ここをクリックしてください!

ここに画像の説明を入力します

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top