在绘图轴上获取希腊字符 [英] Getting greek character in plot axis

查看:65
本文介绍了在绘图轴上获取希腊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作各种材料中不同金属浓度的条形图,并且需要轴表示μg/g .我已经搜索了如何在不同的情节中实现希腊字符,但是我似乎并没有真正做到这一点.看来我应该可以使用(expression(paste))-有人可以帮助我吗?

I am making barplots for different metal concentration in various materials, and need the axis to say μg/g. I've searched for how to implement greek characters into different plots, but I don't seem able to actually do so. It looks like I should be able to use (expression(paste)) - can anyone help me?

这是我当前脚本的摘录:

This is an extract of my current script:

BP.Ag <- ggplot(data=dat, aes(x=Material, y=Ag, fill=Sample.Material)) +  
  geom_bar(stat="identity", position="dodge") + theme_bw() + 
  scale_fill_brewer(palette = "Set1") + ylab("Silver (μg/g)") + guides(fill=FALSE) + theme(axis.text.x = element_text(angle = 45, hjust = 1))

谢谢!

推荐答案

您是否尝试过将µ("\ u00B5")用作UTF-8:

Have you tried the UTF-8 for µ ("\u00B5"):

>cat("\u00B5")
µ

在您的情节中,您可以使用:

In your plot you could use:

ylab("Silver (\u00B5g/g)")

这篇关于在绘图轴上获取希腊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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