2015-12-03 37 views
3

我有一個簡單的代碼,如下所示。我想用數學符號「x \ in [1,10]」創建x-lable,以證明x是連續的並且是特定間隔/集合的成員。無論如何設置?將 in(是該集的成員)符號添加到qplot中

cat("\014") 
require(ggplot2) 
n=10 
x=seq(1,n,0.01) 
y=x*x-2*x-30 
x;y 
m <- qplot(x, y, xlim=c(0,n), xlab = "x in [1, 10]", ylab="", axis = FALSE) 
m 

回答

5

您需要使用expression;看到?plotmath爲列表和示例

require(ggplot2) 
n=10 
x=seq(1,n,0.01) 
y=x*x-2*x-30 
qplot(x, y, xlim=c(0,n), xlab = expression(x %in% '[1, 10]'), ylab="", axis = FALSE) 

enter image description here

相關問題