EverythingRightPlace
EverythingRightPlace

Reputation: 1197

Label-Style in Gnuplot

I use a Perl-script to make several graphs through piping a heredoc to Gnuplot (version 4.6 patchlevel 3). I have some problems to define labels in the desired manner. I want to:

I don't know how to define the format specifiers and I also had a look at the label docu1 [link isn't interpreted correctly] label docu2. This post shows a complicated way how to define the box and has to be set for every label.

Sorry for posting not just one exact question, but they are all concerning the labeling style.

My Gnuplot tests so far:

set style line 1 lt 1 lw 1 lc rgb "#FF4500"
set label 1 'Var1 = sprintf("%5.3f",$Var1)' at graph 0.8, graph 0.95 front font 'Times-Roman,10'
plot "file.dat" u 1:2 ls 1

My problems:

Thx in advance!

Upvotes: 1

Views: 2906

Answers (1)

Christoph
Christoph

Reputation: 48390

Ok, lets see how to get the things sorted:

Using sprintf works like this:

set label 1 sprintf("Var1 = %5.3f",Var1) at ...

or

set label 1 'Var1 = '.sprintf("%5.3f", Var1) at ...

Boxed labels are supported only in the current development version 4.7. You could misuse the key to get a boxed label (if you don't need it otherwise):

set key opaque box samplen -1 at graph 0.8, graph 0.95 font 'Times-Roman,10'
plot 'file.dat' using 1:2 ls 1 title sprintf('Var1 = %5.3f', Var1)

Upvotes: 1

Related Questions