#==============================
# ggplot2: subscript in x-axis labels(ticks)
rm(list=ls(all=TRUE))
library(ggplot2)
data <- data.frame(names=tolower(LETTERS[1:4]),mean_p=runif(4))

p <- ggplot(data,aes(x=names,y=mean_p))
p <- p + geom_bar(colour="black",fill="white")
p <- p + xlab("expressions") + scale_y_continuous(expression(paste("Wacky Data")))
p <- p + scale_x_discrete(labels=c(a=expression(paste(Delta^2)),
                               b=expression(paste(q^n)),
                               c=expression(log(z)),
                               d=expression(paste(omega / (x + 13)^2))))

p

# from: http://stackoverflow.com/questions/6202667/how-to-use-subscripts-in-ggplot2-legends-r

#==============================
# ggplot2: subscript in y-axis labels
rm(list=ls(all=TRUE))
library(ggplot2)
dat <- data.frame(x = rnorm(100), y = rnorm(100))
ggplot(dat, aes(x=x,y=y)) +
     geom_point() +
     labs(y=expression(Blah[1*d]))

ggplot(dat, aes(x=x,y=y)) +
     geom_point() +
     labs(y=expression(Blah["1d"]))
    
ggplot(dat, aes(x=x,y=y)) +
    geom_point() +
    labs(y=expression(Blah[1*d]*"%"))    
    
# from: http://stackoverflow.com/questions/17334759/subscript-letters-in-ggplot-axis-label
# http://stackoverflow.com/questions/8514478/subscripts-in-xlabels-in-ggplot2
# http://stackoverflow.com/questions/15125628/putting-mathematical-symbols-and-subscripts-mixed-with-regular-letters-in-r-ggpl
# http://www.janeshdevkota.com/blog/using-superscripts-and-subscripts-in-ggplot2/

ggplot2 subscript in x-axis labels(ticks, legend)的更多相关文章

  1. Axis.Labels.CustomSize

    tChart1.Axes.Bottom.Labels.CustomSize = ; //Changes spacing occupied by the axis labels between the ...

  2. 3D Slicer Hide 3D Cube and Axis Labels Programmatically 使用代码隐藏三维视图中的方框和坐标轴标签

    在3D Slicer中,我们如果想在自己写的插件中来修改三维视图中的默认设置的话,那么首先就需要获得三维视图的结点,其类型为vtkMRMLViewNode,获得了这个结点后,我们就可以用代码来修改一系 ...

  3. Flot Reference flot参考文档

    Consider a call to the plot function:下面是对绘图函数plot的调用: var plot = $.plot(placeholder, data, options) ...

  4. matplotlib常用操作2

    关于matplotlib学习还是强烈建议常去官方http://matplotlib.org/contents.html里查一查各种用法和toturial等. 下面是jupyter notebook代码 ...

  5. [Python] Statistical analysis of time series

    Global Statistics: Common seen methods as such 1. Mean 2. Median 3. Standard deviation:  the larger ...

  6. ggplot2包--R可视化

    1.ggplot2发展历程 ggplot2是Hadley在爱荷华州立大学博士期间的作品,也是他博士论文的主题之一,实际上ggplot2还有个前身ggplot,但后来废弃了,某种程度上这也是Hadley ...

  7. R:ggplot2数据可视化——进阶(3)

    Part 3: Top 50 ggplot2 Visualizations - The Master List, 结合进阶1.2内容构建图形 有效的图形是: 不扭曲事实 传递正确的信息 简洁优雅 美观 ...

  8. R:ggplot2数据可视化——进阶(2)

    Part 2: Customizing the Look and Feel, 更高级的自定义化,比如说操作图例.注记.多图布局等  # Setup options(scipen=999) librar ...

  9. Notes for GGplot2: Getting started with ggplot2

    Alpha-ma 2016/10/7 1 Introduction of GGplot2 ggplot2 is an R package for producing statistical, or d ...

随机推荐

  1. Java:集合,对列表(List)中的自定义对象按属性(字段)排序(正序、倒序)的方法

    1. 要求 对列表(List)中的自定义对象,要求能够按照对象的属性(字段)进行排序(正序.倒序). 如:用户对象(Member)有用户名(username).级别(level).出生日期(birth ...

  2. Ossec添加Agent端流程总结

    (1) 服务器上添加客户端 在服务器上添加客户端,执行如下命令,按照提示进行输入,红色部分是我们输入的: [root@ossec-server logs]# /var/ossec/bin/manage ...

  3. C++11 delete和default

    Defaulted 函数 C++ 的类有四个特殊成员函数,它们分别是:默认构造函数.析构函数.拷贝构造函数以及拷贝赋值运算符.这些类的特殊成员函数负责创建.初始化.销毁,或者拷贝类的对象. 如果程序员 ...

  4. iOS-通讯录(无界面)

    通讯录(无界面) #import "AppDelegate.h" #import <AddressBook/AddressBook.h> @interface AppD ...

  5. 解决IntelliJ IDEA控制台乱码问题[包含程序运行时的log4j日志以及tomcat日志乱码]

    这里使用的IntelliJ IDEA版本为[IntelliJ IDEA 14.1.4]: 一.控制台打印的程序运行时的log4j日志中包含中文乱码 在IDEA安装目录的bin目录下找到名为" ...

  6. hive外部表删除遇到的一个坑

    hive外部表删除遇到的一个坑 操作步骤 创建某个表(create external table xxx location xxx) 插入数据(insert xxx select xxx from x ...

  7. JVM垃圾回收--年轻代、年老点和持久代

    关键字约定 Young generation –>新生代 Tenured / Old Generation –>老年代 Perm Area –>永久代 年轻代: 所有新生成的对象首先 ...

  8. Linux内核分析:recv、recvfrom、recvmsg函数实现

    先看一下这三个函数的声明: #include <sys/types.h> #include <sys/socket.h> ssize_t recv(int sockfd, vo ...

  9. 有用的SAP System Administration T-CODE

    一,SAP系统管理常用到的事务代码1.  SM51 SAP Servers System Monitoring2.  SM21 SAP系统日志3.  SRZL  SAP计算机中心管理系统(CCMS) ...

  10. 组策略分发Adobe Reader 11教程

    1, 实验环境 域控:Windows Server 2012 R2 客户端:Windows 7 Adobe Reader 版本:11.0.00 2, 获取分发 Adobe Reader 的许可协议 按 ...