1

I use GNUPLOT a lot and I have a question for which I have not found an answer in the very dense documentation. With "set label" I can write a text starting at a position I decide in the command. I wonder if there is any way to extract the screen coordinates where the text ends because I would like to add another graphical item there. The position of the end of the text depend on many things like font type and size and the overall scaling of the plot and the terminal type so I do not know how to calculate this position myself.

4
  • you can specify the end position of a label set label 1 "This is the end" right at screen 0.5,0.5, i.e. a right alignment of the text. But that's probably not what you are looking for?! Commented Oct 9, 2019 at 12:26
  • In fact I want to insert a symbol "inside" the text of the label so I would like to know the length of the text which is generated by the set label (I already know the start). So it does not really help to define the position at the end of the label although that can certainly be useful in other cases. Commented Oct 12, 2019 at 10:06
  • What is the text? What is the symbol? Assuming if you know what the end position is, how would you then insert the symbol into gnuplot? As object or as image...? If you give more details maybe there might be a workaround... Commented Oct 13, 2019 at 17:51
  • It is a logo I want to write consisting of an O and a C written with the C backspaced half a letter width. With my normal size of the plot I can write them at fixed positions but changing the size of the plot changes the positions. I have looked for formatting options but they do not work on all kinds of terminals. Commented Oct 14, 2019 at 19:06

1 Answer 1

1

Check help enhanced text. What about something like:

set label 1 "text before ~O{.0 C} and after" 

Code:

### enhanced text mode: overprint set xrange[0:20] set yrange [8:25] do for [i=10:24:2] { set label i "text before ~O{.0 C} and after" at 1,i font sprintf('",%d"',i) } plot x ### end of code 

Result:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

@BoSundman, by the way... is this an acceptable answer? Did this solve your problem?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.