2015-08-20 89 views
0

所以我在xlabylabbarplot函數中指定了一些字符串,但是我沒有出於某種原因顯示它們。此外,我已指定beside=T和酒吧不併排位置。這裏是代碼:xlab和ylab在barplot中沒有顯示

barplot(height=c(mean(d2$tconv[d2$NFUP==1]), mean(d2$tconv[d2$FUP==1])), 
     col = c(2,3), names.arg=levels(d$progu1), 
     main="Tiempo de Conversión según si el usuario convertido ha acabado la 1era Unidad", 
     ylim=c(0,max(mean(d2$tconv[d2$FUP==1]), mean(d2$tconv[d2$NFUP==1]))+10), 
     xlab="Uso", ylab="Tiempo hasta Conversión", border=F, beside=T) 

結果如下。變焦沒有幫助:

enter image description here

+1

你可以提供一個可重複的例子嗎?我無法複製沒有顯示出樣本數據的軸。 – Heroka

+0

如果比較「無Acaba la Unidad」和「Acaba la Unidad」中的不同組,則在T旁邊工作。對於xlab和ylab我不知道發生了什麼問題。你有失去它們的機會,因爲你做了某種縮放?你的頭銜似乎也被削減。 – AntoniosK

+1

您是否用[參數](https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/par.html)更改了邊距?該圖看起來比它應該小,它可能已經切斷了標籤。 –

回答

1

爲了瞭解身邊= T工作的檢查:

counts <- table(mtcars$vs, mtcars$gear) 


barplot(counts, main="Car Distribution by Gears and VS", 
     xlab="Number of Gears", col=c("darkblue","red"), 
     legend = rownames(counts), beside=TRUE) 


barplot(counts, main="Car Distribution by Gears and VS", 
     xlab="Number of Gears", col=c("darkblue","red"), 
     legend = rownames(counts), beside=FALSE) 


barplot(counts[2,], main="Car Distribution by Gears and VS", 
     xlab="Number of Gears", col=c("darkblue","red"), 
     legend = rownames(counts), beside=TRUE)