Search code examples
plotlayoutlabelgnuplot

gnuplot - place ylabel on top of plot after rotating it by 90 degrees


Rotating a ylabel is (or rather should be) pretty simple:

ylabel "whatever" rotate by 90

After I've rotated the ylabel, though, how can I place it on top of the plot, rather than at its side?


Solution

  • Yes, you have to add the offset flag, e.g. set ylabel "whatever" offset graph 0.5,0.5 rotate by 90

    Note: the ylabel is already vertical (rotated by 90˚), so your rotate by 90 flag doesn't do anyting.

    If you want an horizontal label on the top, you can also use the set title "whatever". Just remember to remove the ylabel you just placed unset ylabel

    Or you can create you own custom label to place whatever you want:

    set label 1 "my label" at screen 0.5,0.4 rotate by 30
    

    Please remember to use the right coordinate system read help coordinates

    Moreover, as @Matthew tells in the comment below, it you take the label "road", you will probably need to adjust margins to get some extra space on the top (using set title "whatever" will handle this automatically). Have a read on help margin to catch up on this.