2012-12-04 6 views

答えて

114

xlimおよびylimここでは切断しません。 expand_limits,scale_x_continuousおよびscale_y_continuousを使用する必要があります。 (x = 5で、例えば、ポイントを参照してくださいあなたは、物事必ずポイントが切断取得されていません作るために少し調整する必要があります

df <- data.frame(x = 1:5, y = 1:5) 
p <- ggplot(df, aes(x, y)) + geom_point() 
p <- p + expand_limits(x = 0, y = 0) 
p # not what you are looking for 

enter image description here

p + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) 

enter image description here

と:試してみてくださいy = 5

+21

私はまた限界を指定する必要がありました: 'scale_x_continuous(expand = c(0、0)、limits = c(0,5))'仕事 –

関連する問題