2017-01-03 16 views
0

ggplot2()でバブルプロットを作成しようとしています。私はグラフのマージンを増やしたいと思いますが、私は何の解決策も試していません。マージンを増やすbubbleplot ggplot2()

グラフは、コード - 私が使用して

enter image description here

をfollingされ、次の

ggplot(data,aes(Var1,Var2,fill=Var1))+ 
    geom_point(aes(size=Var3/3),shape=21,show.legend = FALSE)+ theme(axis.title.y=element_text(vjust=0))+ 
    scale_size_identity()+ 
    theme(panel.grid.major=element_line(linetype=2,color="black",size=0.1), 
     axis.text.x=element_text(angle=90,hjust=1,vjust=0)) 

そしてここでは、データセット

Var1 Var2  Var3 
1 T_1 T1 5.014627 
2 T_12 T1 3.523363 
3 T_3 T1 4.583498 
4 T_7 T1 220.842570 
5 T_9 T1 96.106181 
6 T_1 T2 156.281533 
7 T_12 T2 4.296740 
8 T_3 T2 17.103414 
9 T_7 T2 80.447975 
10 T_9 T2 54.612852 
11 T_1 T3 79.213905 
12 T_12 T3 4.548642 
13 T_3 T3 65.326722 
14 T_7 T3 67.283008 
15 T_9 T3 220.642854 
16 T_1 T4 268.852172 
17 T_12 T4 306.466099 
18 T_3 T4 66.043928 
19 T_7 T4 30.752214 
20 T_9 T4 38.575883 
21 T_1 T5 253.413462 
22 T_12 T5 3.289762 
23 T_3 T5 5.201571 
24 T_7 T5 106.649741 
25 T_9 T5 2.034214 

です、私は非常に感謝提案

+0

「+ scale_x_continuous( expand = c(0.1、0))+ scale_y_continuous(expand = c(0.1、0)) '?そうでない場合は、少なくとも再現可能な例を提示し、うまくいかない「いくつかの解決法」を明確にする必要があります。 – Axeman

+0

この「データ」とは何ですか?この 'Var'と' Var2'はどこですか?この「Var3」とは何ですか? – hrbrmstr

+0

Axemanとhrbrmstr様 - 私はデータセットを使って投稿を編集しました – FranciscoC

答えて

0

例えば::。たとえば

gplot(data,aes(Var1,Var2,fill=Var1))+ 
    geom_point(aes(size=Var3/3),shape=21,show.legend = FALSE)+ theme(axis.title.y=element_text(vjust=0))+ 
    scale_size_identity()+ 
    theme(panel.grid.major=element_line(linetype=2,color="black",size=0.1), 
    axis.text.x=element_text(angle=90,hjust=1,vjust=0))+scale_y_discrete(expand=c(0, 1.5) 
0

plot.margin()またはlegend.margin()を試しましたか?

私は答え、

ちょうど()=のC(0、1.5を展開する+ scale_y_discreteを追加した

plot + theme(..., legend.margin = unit(1, "cm")) 

または

plot + theme(..., panel.margin = unit(1, "cm")) 
+1

これは泡が途切れるのを避けません。 – Axeman

関連する問題