ggplot2 subscript in x-axis labels(ticks, legend)
#==============================
# 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)的更多相关文章
- Axis.Labels.CustomSize
tChart1.Axes.Bottom.Labels.CustomSize = ; //Changes spacing occupied by the axis labels between the ...
- 3D Slicer Hide 3D Cube and Axis Labels Programmatically 使用代码隐藏三维视图中的方框和坐标轴标签
在3D Slicer中,我们如果想在自己写的插件中来修改三维视图中的默认设置的话,那么首先就需要获得三维视图的结点,其类型为vtkMRMLViewNode,获得了这个结点后,我们就可以用代码来修改一系 ...
- Flot Reference flot参考文档
Consider a call to the plot function:下面是对绘图函数plot的调用: var plot = $.plot(placeholder, data, options) ...
- matplotlib常用操作2
关于matplotlib学习还是强烈建议常去官方http://matplotlib.org/contents.html里查一查各种用法和toturial等. 下面是jupyter notebook代码 ...
- [Python] Statistical analysis of time series
Global Statistics: Common seen methods as such 1. Mean 2. Median 3. Standard deviation: the larger ...
- ggplot2包--R可视化
1.ggplot2发展历程 ggplot2是Hadley在爱荷华州立大学博士期间的作品,也是他博士论文的主题之一,实际上ggplot2还有个前身ggplot,但后来废弃了,某种程度上这也是Hadley ...
- R:ggplot2数据可视化——进阶(3)
Part 3: Top 50 ggplot2 Visualizations - The Master List, 结合进阶1.2内容构建图形 有效的图形是: 不扭曲事实 传递正确的信息 简洁优雅 美观 ...
- R:ggplot2数据可视化——进阶(2)
Part 2: Customizing the Look and Feel, 更高级的自定义化,比如说操作图例.注记.多图布局等 # Setup options(scipen=999) librar ...
- 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 ...
随机推荐
- MySQL 自带工具使用介绍
MySQL 数据库不仅提供了数据库的服务器端应用程序,同时还提供了大量的客户端工具程序,如mysql,mysqladmin,mysqldump 等等,都是大家所熟悉的.虽然有些人对这些工具的功能都已经 ...
- JSP中四种传递参数中文乱码问题
查看来源:http://blog.csdn.net/hackerain/article/details/6776083
- 【Unity】7.5 移动设备输入
分类:Unity.C#.VS2015 创建日期:2016-04-21 一.简介 在iOS和Android系统中,操作都是通过触摸来完成的.Input类中对触摸操作的方法或变量如下图所示: 通过GetT ...
- placement new (转)
原文出自:http://www.cnblogs.com/wanghetao/archive/2011/11/21/2257403.html 1. placement new的含义placement n ...
- 源码分析HotSpot GC过程(三):TenuredGeneration的GC过程
老年代TenuredGeneration所使用的垃圾回收算法是标记-压缩-清理算法.在回收阶段,将标记对象越过堆的空闲区移动到堆的另一端,所有被移动的对象的引用也会被更新指向新的位置.看起来像是把杂陈 ...
- (原创)一个和c#中Lazy<T>类似的c++ Lazy<T>类的实现
在.net 4.0中增加一个延迟加载类Lazy<T>,它的作用是实现按需延迟加载,也许很多人用过.一个典型的应用场景是这样的:当初始化某个对象时,该对象引用了一个大对象,需要创建,这个对象 ...
- Linux服务开机自启动使用示例
本文以redis服务为例,介绍了两种服务自启动的方法service,systemctl使用示例 1.修改redis.conf,允许后台运行 daemonize no 改为 daemonize yes ...
- android alipay
"java.security.spec.InvalidKeySpecException" KeyFactory keyFactory =KeyFactory.getInstance ...
- 【ARM】2410裸机系列-uart串口通信
开发环境 (1)硬件平台:FS2410 (2)主机:Ubuntu 12.04 FS2410串口的原理图 串口UART寄存器配置 配置TXD0与RXD0(GPH2.GPH3) 设置波特率(UBRDI ...
- 使用FastJson从json串中根据key获取value
import com.alibaba.fastjson.JSONObject; /** * Created by SYJ on 2017/9/13. */ public class MainTest ...