Reputation:
I have plotted polar coordinates for my data by using ggplot2
.
my dataset is in this format:
Time Lat Long Act
18:00 21.05 70.00 feed
18:45 21.00 75.00 walk
19:00 21.09 77.00 walk
19:05 24.98 77.09 rest
Code :
library(ggplot2)
plot.new()
ggplot(aes(x = Lat, y = Long, colour = Act), data = file) +
geom_point()
ggplot(aes(x= Lat, y = Long , colour = Act), data = file) +
geom_point() +
coord_polar(theta = "y")
This is the polar coordinate plot which I get: here
This plot is having latitude and longitude. Now I would like to add one more dimension "time". How can I do this ?. How can I make this 2D polar plot in 3D polar plot ?
Upvotes: 2
Views: 1557
Reputation: 23788
You could try to scale the size of the points with the value of the variable "time". Unfortunately your example is not reproducible, but something along these lines could work:
ggplot(aes(x= Latitude, y = Longitude , colour = ACTIVITY, size=time), data = Data) + geom_point(shape=21) + coord_polar(theta = "y") + scale_size_area(max_size=10)
Below you can see a reproducible example, which is based on data that is used in "The R Graphics Cookbook" by Winston Chang (O'Reilly 2013).
In this case, the dot size represents the temperature, the color refers to a wind speed category, the direction of the wind is plotted in polar coordinates and the radius is the average value of the wind.
library(gcookbook)
library(ggplot2)
p <- ggplot(wind, aes(x=WindDir, y=WindAvg, size=Temp, fill=SpeedCat)) +
coord_polar() + geom_point(shape=21)+scale_size_area(max_size=10) +
scale_x_continuous(limits=c(0,360),breaks=seq(0,360,by=45))
This is the output:
Hope this helps.
Upvotes: 4