Reputation: 648
I have a dataframe df
and would like to make a point plot.
I could not plot ( or show ) all the values as point ,; only 8 point are shown out of 20. I think, its because of overlapping Lat and Lon?
Is there a way that i can show all the values plotted ie 20 point and not just 8 ?.
Thank you.
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
Upvotes: 1
Views: 3193
Reputation: 4309
They are indeed overlapping. Try using position_jitter
. Fiddle around with width
and height
for finer control.
library(ggplot2)
ggplot() + geom_point(data = df,aes(x = Lon, y = Lat, colour = Value),
position=position_jitter(width=1,height=.1))
Upvotes: 6
Reputation: 5018
library(ggplot2)
ggplot(data = df,aes(x = Lon, y = Lat, colour = Value)) +
geom_jitter()
Upvotes: 2