2
votes

I have a histogram plot where the bars are simply too high that they overlap the box at the top right that displays information about each bar (what do you call this box?)

Currently it looks like this: enter image description here

I'm been tring to change the size (height) of the canvas so that it is taller with set size but I couldn't get it to work. I then used yrange but I don't want to specify more range to solve this problem. I want it so that the inner canvas is more square and not rectangular (more height) without changing the range. How do I do this?

set term png
set output 'output.png'

red = "#FF0000";
green = "#00FF00";
blue = "#0000FF";
skyblue = "#87CEEB";
purple = "#4B0082";

set ylabel "Time (s)"
set xlabel "CPU"
set style data histogram
set style histogram cluster
set style fill solid
set boxwidth 0.9
set grid ytics
set xtics rotate

set title "Compiled with gcc/g++"
plot "processor.dat" using 2:xtic(1) title "-O1" linecolor rgb red, \
            '' using 3 title "-O2" linecolor rgb blue, \
            '' using 4 title "-O3" linecolor rgb green, \
            '' using 5 title "-Os" linecolor rgb skyblue, \
            '' using 6 title "-Ofast" linecolor rgb purple
1

1 Answers

3
votes

The "box" is called "key". In the gnuplot command line, help set key explains its options. You can move it to the empty left upper corner with

set key left

To increase the height of the picture I would change the overall size of the png like this:

set terminal png size 640,640

On my system, your command set term png defaults to set terminal png size 640,480.

To make the plot area an exact square, the following command is used:

set size ratio 1

This is the result with some fake data:

plot without overlapping bars