2017-04-12 2 views
2

플롯 라인이있는 막대 그래프를 생성하기 위해 Gnuplot을 사용하고 있지만, 플롯 라인은 바 헤드와 잘 맞지 않습니다. 또한 바 헤드에서 조금 더 멀리 배치하고 싶습니다. .플롯 라인을 사용한 Gnuplot 히스토그램

enter image description here

set border 3 
set boxwidth 0.9 
set tics nomirror out scale 0.75 
set style fill solid 0.8 

plot "03.txt" using 2:xtic(1) lt rgb "#0060ad" notitle, "" using 2 smooth csplines notitle with lines ls 1, "" using 3 lt rgb "#ff6600" notitle, "" using 3 smooth csplines notitle with lines ls 2, "" using 4 lt rgb "#dd181f" notitle, "" using 4 smooth csplines notitle with lines ls 3 

업데이트 :

이 데이터 파일입니다

이 컬럼의 수를 작동합니다
500000  25.938   25.938  2 
1000000  52.385   52.385  4 
1500000  79.749   78.405  6.125 
2000000  152.589   100.261  12.479 
2500000  224.869   118.364  19.159 
+0

(Y 축 단위) OFFSET 변수 수직 곡선을 상쇄 할 수 있습니다. 나는 당신이 스플라인의'using' 절을 튜닝하면서 원하는 것을 얻을 것이라고 믿지만, 칼럼 2의 내용이 쉬운 선택에 영향을 미칠 수 있습니다. "바 머리에서 조금 더 멀리 놓으십시오"라는 말은 전체 스플라인의 수직 이동을 의미합니까? – Joce

+0

@Joce 나는 데이터 파일을 추가했다. 예, 줄 바꿈으로 줄 바꿈을 피하기 위해 수직 이동이 필요합니다. – Boubakr

답변

2

, 당신은 변수 N에서 그들을 지정해야합니다, 사용자 정의 함수 xbox에 대한 호출로 번호를 지정하십시오. 이것은 비 집중적 인 사용을 위해해야합니다. 당신은 당신의 데이터 파일 (또는 상당한 부분)을 게시하는 것이 좋습니다

set border 3 
#number of columns to be plotted 
N=3 
#vertical offset 
OFFSET=0 
#gapwidth (set to gnuplot's default) 
GW=2 
xbox(x,i)=x+(i-N*0.5)/(N+GW) 
set boxwidth 0.9 
set tics nomirror out scale 0.75 
set style fill solid 0.8 

plot "03.txt" using 2:xtic(1) lt rgb "0060ad" notitle, \ 
     "" using 2 with histogram notitle,  \ 
     "" using (xbox($0,1)):($2+OFFSET) smooth csplines notitle with lines ls 1,  \ 
     "" using 3 lt rgb "#ff6600" notitle with histogram, \ 
     "" using (xbox($0,2)):($3+OFFSET) smooth csplines notitle with lines ls 2,  \ 
     "" using 4 lt rgb "#dd181f" notitle with histogram, \ 
     "" using (xbox($0,3)):($4+OFFSET) smooth csplines notitle with lines ls 3