V-Red
V-Red

Reputation: 249

Placing more text underneath the x-axis in gnuplot

I am thinking of ways to have more text underneath the existing x-axis values in gnuplot. For instance, how can I position additional text in brackets as shown in the below figure?

enter image description here

For now I have simply used Inkscape to modify the image file itself and entered the text manually. Any suggestions on other tools, if not gnuplot?

Upvotes: 3

Views: 1067

Answers (1)

theozh
theozh

Reputation: 25684

One way could be the following. You may want to adjust the bottom margin and the offset of the xlabel.

Code:

### some more extra text at tics
reset session

set sample 11
set bmargin 4.5
set xlabel "x-label" offset 0,-1

plot [0:10] '+' u 0:1:xtic(sprintf("%g\n(a)",$1)) w lp pt 7
### end of code

Result:

enter image description here

Edit:

You also can add different text for each label. Depending on your exact needs it might look for example like this:

Code:

### some more extra text at tics
reset session

set sample 13
set bmargin 4.5
set xlabel "x-label" offset 0,-1

TicData = "a b c A B C α β γ ant bat cat dog"
TicText(n) = sprintf("%g\n(%s)",int(n),word(TicData,int(n)))

plot [0:12] '+' u 0:1:xtic(TicText($0+1)) w lp pt 7 enhanced
### end of code

Result:

enter image description here

Upvotes: 4

Related Questions