Search code examples
gnuplotsymbols

gnuplot symbol size reference


I have a plot with xyerrorbars and I would like to add a reference taking into account the size (length) of the error bars in gnuplot. Like when you plot velocities and add a vector with a reference length in order to better interpret the picture. I am attaching something like what I want. This is a standard gnuplot plot to which I manually added the symbol reference on the botton-left side. Is there a way to do it with some gnuplot commands?

enter image description here


Solution

  • In current gnuplot (version 5.4) you can add extra key entries with your choice of plot style sample, title, and position. However these extra entries inherit the generic properties of the regular key such as font, color, left/right justification, and left/right placement of the text. Because of that, the text "4k x 5k" in the plot shown below appears to the left of the plot sample rather than to the right as it does in your mock-up. You could switch this globally using set key reverse, or with some work you could give a blank title for the extra keyentry and then manually position a text label next to it.

    You show a multiplot, but that does not change anything. The extra key entry could equally well be attached to any of the component plots since its final position is given in screen coordinates.

    set bmargin 6     # leave room for an extra label underneath
    set xrange [0:200]
    set linetype 99 pt 1 lc "blue"
    
    plot 'silver.dat' using 1:2:3:3 lt 99 with xyerrorbars, \
         keyentry with yerrorbars lt 99 title "4k x 5k" at screen 0.1, screen 0.10
    

    enter image description here

    If I have misunderstood your question and you require that the "extra" set of error bars is drawn to a specific horizontal length, then a different solution is possible involving a dummy plot with no visible border, axes, or labels. But that would be a different answer entirely, so please clarify if this simpler approach does or does not meet your requirements.