【问题标题】:"Squared" superscript in ggplot2 yaxis label in RR中ggplot2 y轴标签中的“平方”上标
【发布时间】:2016-04-28 16:30:50
【问题描述】:

我正在使用ggplot2 绘制多线图,并且无法用英里每秒平方标记 y 轴。我已经尝试了命令:

ggplot(data.frame, aes(id)) + labs(y = "Acceleration in m/s^2")

和(搜索堆栈溢出后):

ggplot(data.frame, aes(id)) + labs(y = expression ("Acceleration in m/s[2]")

在这两种情况下,标签都不会创建上标,而是看起来完全像“加速度 m/s^2”。这个ggplot标签的上标命令应该如何构造?

【问题讨论】:

    标签: r ggplot2 superscript


    【解决方案1】:

    试试这个:

     + labs(y = expression ("Acceleration in"~m/s^2))
    

    【讨论】:

    • 或者:labs(y = bquote("Acceleration in"~m/s^2))
    猜你喜欢
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多