2017-05-03 5 views
1

私はデータフレームdfを持っており、ポイントプロットをしたいと考えています。 すべての値をポイントとしてプロット(または表示)できませんでした。 20点中8点しか表示されていません。LatとLonが重なっているので 私はすべての値をプロットすることができる、つまり20ポイントだけでなく8ポイントを表示する方法はありますか? ありがとうございます。 enter image description hereggplot2のすべての点をプロットする方法は?

dput(df) 
structure(list(Lat = c(55.5, 49.5, 49.5, 60, 58.5, 55.5, 54, 
49.5, 55.5, 52.5, 58.5, 55.5, 55.5, 55.5, 55.5, 52.5, 55.5, 49.5, 
49.5, 48, 58.5), Lon = c(-132, -126, -124.5, -139.5, -136.5, 
-132, -129, -126, -132, -127.5, -136.5, -132, -132, -132, -132, 
-127.5, -132, -126, -126, -123, -136.5), Value = c(169, 308, 
178, 110, 224, 280, 212, 365, 224, 276, 121, 159, 166, 342, 96, 
283, 51, 375, 198, 284, 201)), .Names = c("Lat", "Lon", "Value" 
), row.names = c(168969L, 169011L, 169123L, 169285L, 169570L, 
169611L, 169858L, 169905L, 170237L, 170263L, 170483L, 170496L, 
170666L, 170684L, 170815L, 170834L, 170893L, 170916L, 171073L, 
171093L, 171201L), class = "data.frame") 

p <- ggplot() + 
    geom_point(data = df,aes(x = Lon, y = Lat, colour = Value)) 
p 
+0

通常 'geom_count'は良いオプションになりますが、あなたは、カラーマッピングを失うことになります。 – Axeman

答えて

5

彼らは確かに重複しています。 position_jitterを試してみてください。より細かい制御のためにwidthheightでフィンドル周辺。

library(ggplot2) 

ggplot() + geom_point(data = df,aes(x = Lon, y = Lat, colour = Value), 
position=position_jitter(width=1,height=.1)) 

enter image description here

2


library(ggplot2) 

ggplot(data = df,aes(x = Lon, y = Lat, colour = Value)) + 
    geom_jitter() 

関連する問題