Reputation: 1465
I have an R plot with an axis of dimension squared Angstroms.
I can create the correct Angstrom symbol with Unicode like so:
plot.new()
text(x=0.5, y=0.8, labels="Interface area (\uc5)")
Both of my attempts to add a superscript result in errors:
plot.new()
text(x=0.5, y=0.6, labels=expression("Interface area ("*\uc5^2*")"))
# Error: unexpected input in "text(x=0.5, y=0.6, labels=expression("Interface area ("*\"
plot.new()
text(x=0.5, y=0.5, labels=expression("Interface area (\uc5"*^2*")"))
# Error: unexpected '^' in "text(x=0.5, y=0.5, labels=expression("Interface area (\uc5"*^"
Currently I am using a typographically incorrect hack:
plot.new()
text(x=0.5, y=0.7, labels=expression("Interface area ("*ring(A)^2*")"))
(Note that the ring over the A is too large)
Can I correct my syntax of expression() to use both backslash unicode characters and superscript?
Note: I've looked at this question but it concerns direct use of the unicode character rather than the backslash representation.
Upvotes: 2
Views: 1616
Reputation: 103938
I think the cleanest way is probably:
plot.new()
text(0.5, 0.7, labels = quote("Interface area " * (Å ^ 2)))
Upvotes: 2