I am new to gnuplot and while plotting stacked histogram, I find that legend gets hidden behind the data.
Is there a method to put the legend above the data? Thanks a lot for your help. EDIT: I am currently using set key outside bottom to place legend outside, but that is not the best solution I would like.
Recent versions allow to make the background of the legend white:
set key opaque
This simply adds a white background to the legend so it appears on top of all graphs. Found the answer in this Post.
If you would rather have the key on top of the data rather than the key outside the plot box altogether, here is one workaround (using sin(10*x) as an example):
set multiplot
unset key
plot sin(10*x) # this will plot with tics and a border, but no key
set key box
unset tics
unset border
bignumber=10 # make this number larger than the y range so the line will not be seen
plot [][0:1] bignumber title 'sin(10*x)' # this will just plot the key with the title
unset multiplot
Using this method, first you plot your data/function, then you create a plot on top of that which just has a key. You have to make sure to set the title of the second plot properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With