Menu

label position question

Help
2017-03-21
2017-03-21
  • Brian Murphy

    Brian Murphy - 2017-03-21

    I would like to place a boxed label near the lower left corner of the plot canvas, and I'd like the contents of the box to be centered. Is this possible without knowing in advance how wide or how high the box will be?

     
  • Ethan Merritt

    Ethan Merritt - 2017-03-22

    In the development version (version 5.1) there is a "boxed" option for labels that draws a perfect bounding box and allows control over the margin, border color, etc.
    See for example the online demo
    http://gnuplot.sourceforge.net/demo_5.1/textbox.html

    The release version 5.0 has relatively primitive subset that allows you to put a box around the text but offers no control over color, size, etc.
    http://gnuplot.sourceforge.net/demo/datastrings.html

    In either case the "boxed" option can be specified for individual labels or for "plot ... with labels".

     
  • Brian Murphy

    Brian Murphy - 2017-03-22

    Thanks for the reply. I'm trying to put a boxed label outside the actual data plot, in the lower left corner of the plot canvas. The set label command has options for left,center,right, but whichever is chosen seems to be dual purpose. Choosing center, for example, centers the text within the label, and also positions the label centered about the specified < position >. That's ok, unless one wants to put the label near an edge of the plot canvas.

     
  • Ethan Merritt

    Ethan Merritt - 2017-03-22

    Use left-justified text if you want it to hug the left edge of the canvas, and right-justified text if you want it to hug the right edge.  If you want to tweak the positioning a bit after that, add "offset <xtweak>, <ytweak>" to the label command. Here's a junk plot just to show a label in the lower left, produced with

    set label 1 at screen 0, 0 "Some label at lower left" offset 1,1
    set xlabel "X LABEL"
    plot sinc(x)
    
     
  • Brian Murphy

    Brian Murphy - 2017-03-23

    Thanks for the suggestion. My label has three lines of text, so I would like to stick with the center option (maybe I'm just being too picky). In this application it will always be three lines. The width will be variable, but not so much that I can't live with hardcoding the position values. So that's what I'll do.

    Perhaps in a future version of gnuplot the left/center/right can be specified separately for a label's contents and position.

    I can't tell you how pleased I am I can finally do real 3d graphs in Excel. Lotus 123 could do it over 25 years ago. It's a shame Microsoft has never added this, and probably never will. Could be a case of market dominance leading to brain damage.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.