ggplot2 - 3D polar plot in R -
i have plotted polar coordinates data using ggplot2
.
my dataset in 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 polar coordinate plot get: here
this plot having latitude , longitude. add 1 more dimension "time". how can ?. how can make 2d polar plot in 3d polar plot ?
you try scale size of points value of variable "time". unfortunately example not reproducible, along these lines 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 can see reproducible example, based on data used in "the r graphics cookbook" winston chang (o'reilly 2013).
in case, dot size represents temperature, color refers wind speed category, direction of wind plotted in polar coordinates , radius average value of 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 output:
hope helps.
Comments
Post a Comment