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

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Feb 20 14:37:49 CET 2025


On 2025-02-19 6:36 a.m., Paul Sherliker via R-help wrote:
> 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.

This web page:  https://www.compart.com/en/unicode/category/Pd lists a 
lot of choices.  You didn't say what the complaints were ("too long"? 
"too short"?), so I can't recommend what to try other than \U{2010}, but 
there is a big variety of choices there.

Duncan Murdoch

> 
> 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]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list