Reputation: 83
I have drawn the bar chart above using the following code:
set terminal jpeg medium
set output "bar.jpeg" # shall be the name of the chart
set xlabel "full configuration time in msec"
set ylabel "Task rejection rate (%)"
set boxwidth 0.5
set style fill solid
#set autoscale
plot "data.data" using 1:2 with boxes
My file data.data
looks like this:
2 9
5 24
7 46
10 66
15 100
I want the exact values 2,5,7,10,15 to appear along the x axis with the corresponding value along the y axis and to use a color other than red. What changes do I have to make to my code? I also need to remove that "data.data" using 1:2
from the top right corner...
Any suggestions?
Upvotes: 2
Views: 3479
Reputation: 48390
In addition to @TomFenech's answer: If you want to show only the x-values specified in the data file, you can use the xtic
function. Note, that in this case the defined x-format has no effect and the value is taken 'as-is':
set xlabel "Full configuration time in msec"
set ylabel "Task rejection rate (%)"
set boxwidth 0.5
set style fill solid
set xtics out nomirror
plot "data.data" using 1:2:xtic(1) with boxes notitle
Upvotes: 1
Reputation: 74615
To remove the key, use unset key
.
The markers at the bottom of the graph are called xtics
. If you want them to appear every 1, rather than every 2, then you could use set xtics 1
. Depending on exactly what you wanted to do, you can customise the xtics even more. In gnuplot if you do help xtics
there's plenty of information on that.
To change the colour of your boxes, you can use the lc
(line colour) property. I have used a hexadecimal #RRGGBB
format but you can also use names of colours like green
, blue
, etc. Look at help linecolor
for more info on that.
Incorporating all of those changes into your script:
set xlabel "full configuration time in msec"
set ylabel "Task rejection rate (%)"
set boxwidth 0.5
set style fill solid
unset key
set xtics 1
plot "data.data" using 1:2 with boxes lc rgb '#52bb23'
By the way, I used the pngcairo
terminal rather than the jpeg
one as I think it looks better. Try set term
to see what terminals are available to you.
Upvotes: 1