[R] non ascill characters in plots. no alternative but plotmath?
Paul Johnson
pauljohn32 at gmail.com
Thu Jun 7 01:23:20 CEST 2012
A student entered some data with text characters like epsilon and
alpha. On her Windows system, the Greek letters did not display
properly in a plot. There were some ordinary ASCII instead.
I asked her to send me the code so I could test. For me, the plot
looks ok on the screen.
Format1 <- c(320,500,700,1000,500,320,700,500,320)
Format2 <- c(800,1000,1150,1400,1500,1650,1800,2300,2500)
Vowel <- c("u","o", "α", "a","ø", "y", "ε", "e","i")
V1 <- data.frame(Format1,Format2,Vowel)
plot(Format1 ~ Format2, data = V1, type="n")
text(V1$Format2, V1$Format1, labels=V1$Vowel)
On my Debian linux system, the plot shows the Greek letters just fine
in the screen device.
However, I turned on a pdf device to run the same code and see signs
of trouble.
> text(V1$Format2, V1$Format1, labels=V1$Vowel)
Warning messages:
1: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'α' in 'mbcsToSbcs': dot substituted for <ce>
2: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'α' in 'mbcsToSbcs': dot substituted for <b1>
3: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
font metrics unknown for Unicode character U+03b1
4: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'α' in 'mbcsToSbcs': dot substituted for <ce>
5: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'α' in 'mbcsToSbcs': dot substituted for <b1>
6: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'ε' in 'mbcsToSbcs': dot substituted for <ce>
7: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'ε' in 'mbcsToSbcs': dot substituted for <b5>
8: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
font metrics unknown for Unicode character U+03b5
9: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'ε' in 'mbcsToSbcs': dot substituted for <ce>
10: In text.default(V1$Format2, V1$Format1, labels = V1$Vowel) :
conversion failure on 'ε' in 'mbcsToSbcs': dot substituted for <b5>
The alpha and epsilon characters don't appear in the pdf. I don't
know the proper terminology to describe the situation, thus I don't
know where to start reading. Until very recently, I didn't even know
it was possible to directly enter these characters in Emacs, but I've
learned that part.
I understand you might answer "use plotmath", if if that's the only
workable thing, I will teach her how. But that's a little bit of an up
hill climb (from where we are now standing). It will be a lot more
work for me to teach about expressions and whatnot, so if there is a
direct route from a column of non ASCII characters to a plot that has
those characters in it, I'd be glad to know.
pj
--
Paul E. Johnson
Professor, Political Science Assoc. Director
1541 Lilac Lane, Room 504 Center for Research Methods
University of Kansas University of Kansas
http://pj.freefaculty.org http://quant.ku.edu
More information about the R-help
mailing list