[R] Plot math symbol with string and number

Rasmus Liland jr@| @end|ng |rom po@teo@no
Tue Aug 18 10:57:13 CEST 2020


On 2020-08-18 11:02 +1200, Paul Murrell wrote:
| On 18/08/20 9:54 am, Bert Gunter wrote:
| | On Mon, Aug 17, 2020 at 2:14 PM <cpolwart using chemo.org.uk> wrote:
| | | 
| | | Plotmath seems to be the right way 
| | | to do it.  But without reading 
| | | plotmath I'd have gone with this:
| | | 
| | | plot(y, main=paste("data", "\u03C3=", s))
| | 
| | "Plotmath seems to be the right way 
| | to do it."
| | 
| | Not sure I agree with that. Paul 
| | Murrell put together plotmath around 
| | 2000 prior to the widescale 
| | development and adoption of the 
| | unicode standard 
| | (corrections/modifications 
| | welcome!).  So at the time, there 
| | really was no other way to handle 
| | this for most OS'es. With UTF8 now 
| | being generally supported for 
| | Unicode, plotmath constructions may 
| | not be needed for simple symbol 
| | labeling, as here. Of course for 
| | more complex symbolism (fractions, 
| | integrals, ...) it will be. 
| | ?plotmath talks about this and has 
| | links to further issues and options, 
| | btw.
| | 
| | In other words, unicode may indeed 
| | be better than my suggestion of 
| | plotmath here.
| 
| I think that comment is fair *on 
| graphics devices that can handle 
| unicode*.
| 
| So that is true for Cairo-based 
| graphics devices, but not for the 
| pdf() or postscript() devices, for 
| example.

Eventhough I'm a heavy user of pdf(), I 
didn't notice at first that the sigma 
gets converted to two dots with the 
error messages

	Warning messages:
	1: In title(...) :
	  conversion failure on 'data σ= 1' in 'mbcsToSbcs': dot substituted for <cf>
	2: In title(...) :
	  conversion failure on 'data σ= 1' in 'mbcsToSbcs': dot substituted for <83>
	3: In title(...) :
	  conversion failure on 'data σ= 1' in 'mbcsToSbcs': dot substituted for <cf>
	4: In title(...) :
	  conversion failure on 'data σ= 1' in 'mbcsToSbcs': dot substituted for <83>

like if it was a Han character (most 
likely three dots in that case), I just 
ran with cpolwart's suggestion in 
whatever is the default on the R 
console, probably that Cairo thing.  
png() works ofc. 

V

r

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200818/fc34fe32/attachment.sig>


More information about the R-help mailing list