显示大于或等号 [英] Displaying a greater than or equal sign

查看:12
本文介绍了显示大于或等号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样生成的图:

I have a plot which is generated thus:

ggplot(dt.2, aes(x=AgeGroup, y=Prevalence)) + 
    geom_errorbar(aes(ymin=lower, ymax=upper), colour="black", width=.2) +
    geom_point(size=2, colour="Red")

我像这样控制 x 轴标签:

I control the x axis labels like this:

scale_x_discrete(labels=c("0-29","30-49","50-64","65-79",">80","All")) +

这可行,但我需要将>80"标签更改为≥80".

This works but I need to change the ">80" label to "≥80".

但是≥80"显示为=80".

However "≥80" is displayed as "=80".

如何显示大于号或等号?

How can I display the greater than or equal sign ?

推荐答案

使用表达式的替代方法是 Unicode 字符,在本例中为 Unicode 字符 'GREATER-THAN OR EQUAL TO' (U+2265).复制@mnel 的例子

An alternative to using expressions is Unicode characters, in this case Unicode Character 'GREATER-THAN OR EQUAL TO' (U+2265). Copying @mnel's example

.d <- data.frame(a = letters[1:6], y = 1:6)

ggplot(.d, aes(x=a,y=y)) + geom_point() + 
    scale_x_discrete(labels = c(letters[1:5], "u2265 80"))

如果您难以记住复杂的表达式语法,或者您需要换行符,而这些表达式不允许使用换行符,则 Unicode 是一个不错的选择.不利的是,特定的 Unicode 字符是否有效取决于您的图形设备和选择的字体.

Unicode is a good alternative if you have trouble remembering the complicated expression syntax or if you need linebreaks, which expressions don't allow. As a downside, whether specific Unicode characters work at all depends on your graphics device and font of choice.

这篇关于显示大于或等号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆