2013-01-17 21 views
-1

您可以在this page中查看示例。如何在使用theme_wsj {ggthemes}時使xlab和ylab可見?

請注意,在theme_wsj例如,xlabylab不會出現。

這裏有一個非ggthemes情節,包括標籤:

ggplot(mtcars, aes(factor(cyl), mpg)) + 
geom_point() + 
xlab("Hello World: X axis") + 
ylab("Hello World: Y axis") 

但是,當你添加theme_wsj主題,它們就會消失:

ggplot(mtcars, aes(factor(cyl), mpg)) + 
geom_point() + 
xlab("Hello World: X axis") + 
ylab("Hello World: Y axis") + 
theme_wsj() 
+0

,這是例子不夠一個真正的問題。我只是編輯它來演示問題。 @ didzis-elferts解決方案很好地修復了它。 –

回答

7

如果你看看上的theme_wsj()即可源代碼看到該軸標題設置爲空白

theme_wsj<-function(base_size=12, color="brown", base_family="sans", title_family="Courier") { 
    colorhex <- ggthemes_data$wsj$bg[color] 
    (theme_foundation() 
    + theme(
..... 
     axis.title=element_blank() 
.... 

所以一個lution去顯示xlabylab是實際添加新的主題元素

+theme_wsj()+theme(axis.title=element_text(size=12)) 
相關問題