[R] Code \255 no longer working to produce a short dash in base R PDF graphs

Paul Sherliker p@u|@@her||ker @end|ng |rom ndph@ox@@c@uk
Wed Feb 19 12:36:15 CET 2025


I make graphs, in large quantities, for perfectionists.

My bosses do not like the results of text like 'baseline-defined' in graphs; they feel that the resulting dash is too long.

For many years, I have been in the habit of producing graphs with shorter dashes as follows:

pdf("myfile.pdf")
plot(1, 10)
text(1, 11, "baseline\255defined")
text(1, 9, "done")
graphics.off()

They like that dash - but I never knew what it was called.

Recently work updated my PC to the latest version of Windows, and, perforce, I updated to the latest version of R (4.4.2).
(So I'm not sure which change caused my problem; in any case I cannot practically go back for either.)

The code above now fails, with the error message:
Error in text.default(1, 11, "baseline\xaddefined") : invalid input 'baseline> text(1, 9, "done")

I'm trying various Unicode values, currently settling on \U{2010}, but I'm getting complaints about the length of my dashes.
I'm no expert on fonts, and perhaps I've missed a Unicode value that would be perfect.

Is there a way to get back to what I had, without resorting to more complicated code, please?

Thank you for looking at my deeply obscure niche problem!

                               Paul

	[[alternative HTML version deleted]]



More information about the R-help mailing list