2016-05-03 12 views
1

私はリッチパッケージを使用しており、自分の選択データを示すプロットを生成することができます。塗りつぶしの色を手動で指定する方法も知っています。しかし、バーにアウトラインを追加して、少しポップさせるようにしたいと思います。何か案は?リッカートパッケージ - バーにアウトラインを追加

p = plot(lk, plot.percents=FALSE, plot.percent.low=FALSE, plot.percent.high=FALSE, plot.percent.neutral=FALSE, group.order=c("MJ", "ASM", "Both", "Both."), legend.position='right') + theme(axis.text.x=element_text(colour="black", size=12)) + theme(axis.text.y=element_text(colour="black", size=12))+ggtitle("B") + theme(plot.title=element_text(hjust=0)) + scale_fill_manual(values=c("gray86", "dark grey"), name="Preference") 

答えて

3

一つの方法は、(あなたがいずれかを提供しなかったので、likertデモデータを使用して)update_geom_defaults()使用することです::

library(likert) 
library(viridis) 
library(ggplot2) 

data(pisaitems) 
items29 <- pisaitems[,substr(names(pisaitems), 1,5) == 'ST25Q'] 
names(items29) <- c("Magazines", "Comic books", "Fiction", 
        "Non-fiction books", "Newspapers") 
l29 <- likert(items29) 

update_geom_defaults("bar", list(colour="white", size=0.15)) 

p <- plot(l29, 
     plot.percents=FALSE, 
     plot.percent.low=FALSE, 
     plot.percent.high=FALSE, 
     plot.percent.neutral=FALSE, 
     legend.position='right') 
p <- p + ggtitle("B") 
p <- p + theme(axis.text.x=element_text(colour="black", size=12)) 
p <- p + theme(axis.text.y=element_text(colour="black", size=12)) 
p <- p + theme(plot.title=element_text(hjust=0)) 
p <- p + scale_fill_viridis(discrete=TRUE) 
p 

enter image description here

+0

働いここ

は、いくつかのサンプルコードです完全に。ありがとう!そして、はい、コードのプレゼンテーションははるかにクリーンです。私は将来の投稿に注意した。 – RSchaeffer

関連する問題