2016-08-02 49 views
0

我有一個簡單數據幀的值,併產生一個散點圖:ř散點圖,變換用作標籤

a <- c(-1,-2,-1.5) 
b <- c(1,3,2) 
df <- data.frame(a,b) 
plot(a , b) 

結果: enter image description here

我想除去x軸標籤之前的減號,即將標籤乘以-1。

是否可以這樣做,還是必須在標籤的數據框中創建另一列?

回答

2

嘗試

plot(a, b, xaxt = "n") 
pos <- axTicks(1) 
axis(1, at = pos, labels = abs(pos)) 

enter image description here