내가 data.dat
으로이 파일을 보내고 있습니다 :gnuplot에서 숫자가있는 x 축이있는 막대 그래프?
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
을 그리고 호출하여 : :이 스크립트를 히스토그램으로이 데이터를 플롯 할 수 있습니다
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
사용)
gnuplot hist-v1.gplot && eog hist-v1.png
이 이미지가 생성됩니다. image hist-v1.png http://img202.imageshack.us/img202/3974/histv1.png
그러나 X 축의 수치가 비례하지 않음을 알 수 있습니다. 범주 축입니다).
내가 hist-v2.gplot
이 (with boxes
를 사용하여) 다음과 같은 스크립트를 더 숫자 X 축를 얻을 수 있습니다 :
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
이 이미지가 생성됩니다 image hist-v2.png http://img266.imageshack.us/img266/6717/histv2.png
불행히도 막대 그래프가 여기에서 겹쳐서 그래프를 읽는 것이 어렵습니다.
숫자 축척 X 축을 hist-v2.png
으로 유지하는 방법이 있습니까? hist-v1.png
과 같이 '막대'를 나란히 배치 하시겠습니까?
하지만, 데이터 파일의 밖으로 x 좌표 날짜를 당겨 힘들 것입니다 ...
하지만, 그것은을 의미 :이 스레드는 "Re: Histogram with x axis date error가"라고 당신은 할 수 없습니다 다른 문제 ...
감사합니다,
건배!
많은 감사합니다! – sdaau