2017-05-12 2 views
0

Boxes of Plot (gnu 플롯을 통해 플롯)의 중간에 글을 쓰려고하는데 우아한 방법을 찾을 수 없습니다. 모든 상자의 중간 지점을 수동으로 찾는 것은 지루합니다. 알아 내도록 안내해주세요. Here at the position of circles, I want to add some text, verticallyGnuPlot : 상자 가운데에 일부 텍스트 쓰기

+1

사용 예 :'줄거리 : enter image description here

로 데이터 파일 test.dat 가정. – Christoph

답변

1

@Christoph는 의견에 언급했듯이 plot ... w labels도 옵션 중 하나입니다. 유일한 추가 성분은 레이블의 위치를 ​​계산하는 것입니다.

set terminal pngcairo 
set output 'fig.png' 

fName='test.dat' 

bw = 0.9 

yMin = 50 
yMax = 130 

xMin = 2 
xMax = 15 

set boxwidth bw 

set xr [xMin - bw/2:xMax + bw/2] 
set yr [yMin:yMax] 

#scale 0 makes sure that the tic marks don't "show up" 
set format x "1 %.0f" 
set xtics 2,1,15 rotate by -15 scale 0 

set ytics 50,10,130 scale 0 

set ylabel "TODO" 
set xlabel "TODO" 

set key top right 

#place the labels in the "middle" with respect to the 
#minimum on the y-axis 
p \ 
    100 t "Todo" lc rgb "black" dt 3, \ 
    fName u 1:2 w boxes t "TODO" lc rgb "black", \ 
    fName u 1:(($2-yMin)/2+yMin):(sprintf("%.0f", $2)) w labels t '' tc rgb 'dark-red' 

이 생산 :로 하나는 예를 들어 진행할 수 labels`와

2 100 
3 75 
4 74 
5 76 
6 74 
7 78 
8 92 
9 98 
10 75 
11 105 
12 118 
13 120 
14 122 
15 122 
관련 문제