在geom_text中大致相等 [英] Plot approximately equal in geom_text

查看:117
本文介绍了在geom_text中大致相等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 geom_text 插入的文本之前,我不知道如何放大约等于符号。这可以工作:

pre $ g $ p $ ggplot(data.frame(x = 1:2,y = 1:2),aes(x = x,y = y))+ geom_point()+
geom_text(aes(label =10 ^ 10,x = 1.5,y = 1.5),parse = T)

如果我在文本之前放置%~~%

  ggplot(data.frame(x = 1:2,y = 1:2),aes(x = x,y = y))+ geom_point )+ 
geom_text(aes(label =%~~%10 ^ 10,x = 1.5,y = 1.5),parse = T)

它返回一个错误:意外SPECIAL%~~%



我发现了几个相关的问题,但无法应用给出的建议。我使用包ggplot2_0.9.2.1。 Package grDevices也被加载。

解决方案

它可以在等式左边的网站上使用。这也可以是 NULL

  ggplot(data.frame(x = 1:2,y = 1:2),aes(x = x,y = y))+ geom_point()+ 
geom_text(aes(label =NULL%~~%10 ^ 10,x = 1.5,y = 1.5),parse = T)


I cannot realize how to put approximately equal symbol before the text inserted with geom_text. This works:

ggplot(data.frame(x=1:2, y=1:2), aes(x=x,y=y)) + geom_point() +
  geom_text(aes(label="10^10", x=1.5, y=1.5), parse=T)

If I put %~~% before the text

ggplot(data.frame(x=1:2, y=1:2), aes(x=x,y=y)) + geom_point() +
  geom_text(aes(label="%~~%10^10", x=1.5, y=1.5), parse=T)

it returns an error: unexpected SPECIAL %~~%

I found several related questions but could not apply the given advices. I use package ggplot2_0.9.2.1. Package grDevices is also loaded.

解决方案

It will work with something on the left-hand site of the equation. This could also be NULL.

ggplot(data.frame(x=1:2, y=1:2), aes(x=x,y=y)) + geom_point() +
   geom_text(aes(label="NULL%~~%10^10", x=1.5, y=1.5), parse=T)

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

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