user3902605
user3902605

Reputation: 25

How to give text on each bar in GNUPlot graph

i want to add text such as 200,300,600,800 etc on each bar vertically in my graph.This is my code.

set title font ", 25" 
set xlabel "FEATURE LENGTH"
set xlabel font ",25"
set ylabel "ACCURACY(%)"
set yrange [45:76]
set ylabel font ",25"
set ytics font ", 25" 
set boxwidth 0.98
set key spacing 3
set key font ",25"



set style fill pattern 10 border lt -1
set style histogram errorbars gap 1 lw 0 

set key inside top center horizontal font "Helvetica, 25" width 1.8
set style histogram clustered #gap 5 title  offset character 0, 0, 0
set xtics font ", 25" 
set xtics ("F1" 0, "F2" 1, "F3" 2, "F4" 3, "F5" 4, "F6" 5, "F7" 6, "F8" 7, "F9" 8)
set style data histograms

plot "best_feature_pos.dat" using 1 t "{/Symbol a}", "" using 2 t "{/Symbol b}"
set output 'best_feature_pos10.eps'
set terminal postscript eps enhanced black
replot

This is my data file

72.9    73.6
73.9    72.8
70.6    70.9
64      64
66      65.4
59      0
57.4    0
45.8    0
64.8    0

anybody can help me to find the solution???

Upvotes: 1

Views: 855

Answers (1)

Tom Fenech
Tom Fenech

Reputation: 74596

You can use set label to position text over your plot, for example:

set label 1 '200' front at screen 0.15,0.5 rotate by 90 font "Arial,20"
set label 2 '300' front at screen 0.16,0.5 rotate by 90 font "Arial,20"
# etc. 

This will take a bit of manual adjustment to get the labels in the right place.

Upvotes: 2

Related Questions