For your special case of a circle, you can use set label ... point pointtype ...
to attach a point from the available pointtype
s to the label:
set label 'mylabel' at 0,0 left offset char 2,0 point pointtype 7 pointsize 5 lc rgb 'blue'
plot x
Question
I am trying to assign a label to a specific point that I draw with
set object circle at first 3,3 radius char 1.5 fill color rgb "red" fillstyle solid no border
I can't find any way to actually draw a circle with set object, and also assign a label to it, without being forced to create a separate label and place it manually beside the point.
IS there a simple way to just plot a single point with a label, beside set object circle and a separate label? Thanks.
No correct solution
OTHER TIPS
For your special case of a circle, you can use set label ... point pointtype ...
to attach a point from the available pointtype
s to the label:
set label 'mylabel' at 0,0 left offset char 2,0 point pointtype 7 pointsize 5 lc rgb 'blue'
plot x
As far as I know, its not possible. Even the demo script uses a label and a object separately. You could define your own macros though (this example uses boxes not circles):
#!/usr/bin/gnuplot -p
set macro
labelMacro(i,x,y,l) = sprintf('set obj %d rect at %f,%f size char strlen("%s"), char 1; set label %d at %f,%f "%s" front center', i, x, y, l, i, x, y, l)
label1 = labelMacro(1, 0, 0, "Hello World")
label2 = labelMacro(2, -2, -2, "Hello World")
label3 = labelMacro(3, 2, 2, "Hello World")
label4 = labelMacro(4, -2, 2, "Hello World")
@label1; @label2; @label3; @label4;
set xrange [-5:5]
plot x
The above code produces the following graph:
In gnuplot labels and objects are different things, they occupy different "namespaces".
@ilent2's answer is workable, with the small modification that instead of macros you can use eval:
labelMacro(i,x,y,l) = sprintf('set obj %d rect at %f,%f size char strlen("%s"), char 1; set label %d at %f,%f "%s" front center', i, x, y, l, i, x, y, l)
eval labelMacro(1, 0, 0, "Hello World")
Relatively new versions of gnuplot also have boxed labels:
set label 137 "foo" boxed