2012-11-02 70 views
1

在默認的萊迪思條形圖中,分類變量標籤位於左側。我想把它們放在正確的位置。我可以使用scales來操作數字刻度和標籤的位置,但在移動分類標籤時沒有成功。研究help(barchart)和Sarkar的書沒有得出答案(這並不是說答案不存在)。如何將分類標籤放在條形圖的右側?

回答

2

您在scales論點的正確軌道上。嘗試將alternating = 3添加到y比例參數列表中。

barchart(variety ~ yield, data = barley, groups = year, stack = TRUE, 
     ylab = "Barley Yield (bushels/acre)", 
     scales = list(x = list(rot = 45), y = list(alternating = 3)), 
     horizontal = TRUE) 

enter image description here

+0

優秀。謝謝。我想我試過使用'alternating = 3',但是把它放在'scales = list()'列表的最頂層,而不是列在'y = list()'的另一個列表中。 – Mars

相關問題