ggplot&ie与parse = T等于符号问题

问题描述

我需要你的帮助。这个问题似乎很简单,但是我找不到解决方案。看一下代码

library(ggplot2)
ggplot() +
  annotate("text",x = 20,y = 0.25,label = "Model R^2 = 0.4",parse = TRUE)

看看图片中的结果:

enter image description here

我怎么办才能看到“ =”符号?

解决方法

使用=时,您要告诉R将字符串转换为R表达式。这些表达式具有特定的语法,该语法限制了允许空格的位置,并且还要求等号library(ggplot2) ggplot() + theme_classic() + annotate("text",x = 20,y = 0.25,label = "Model~~R^2~`=`~0.4",parse = TRUE) 被“保护”。下面显示了实现此目的的一种方法。

@bot.command()
async def vote(reaction,ctx) :
    vote = ctx.message.content[4:].split(" / ")
    await ctx.send(ctx.channel,"[Vote] - " + vote[0])
    for i in range(1,len(vote)) :
        choose = await ctx.send(ctx.channel,"```" + vote[i] + "```")
        await ctx.add_reaction(choose,"⭕")
        await ctx.add_reaction(choose,"❌")