If you are referring to the sprintf built-in function in gnuplot, the documentation help sprintf says:
sprintf("format",var1,var2,...) applies standard C-language format
specifiers to multiple arguments and returns the resulting string. If
you want to use gnuplot's own format specifiers, you must instead
call gprintf(). For information on sprintf format specifiers,
please see standard C-language documentation or the unix sprintf man
page.
In the Unix man page for %f says (truncated):
%f, %F -- The double argument is rounded and converted to decimal
notation
in the style [-]ddd.ddd, where the number of digits after the
decimal-point character is equal to the precision specification.
Hence, you need to use a different format specifier. As fedorqui pointed out the appropriate format specifier is %s.
I often refer to the table in this link for looking up the appropriate format specifiers (I find the C man page a bit long).
Using sprintf with strings from files
In order to use sprintf to format a string from a file, you need to specify the column in the file to extract the string information from. This needs to be done using the stringcolumn command instead of just using a $ sign.
For example, if you wanted to include a number from a file you might use a command like:
plot "data.dat" using 1:2:(sprintf('%f', $3)) with labels
But for a string you need:
plot "data.dat" using 1:2:(sprintf('%s', stringcolumn(3))) with labels