Learning R: Plotting Data in Polar Coordinates
I’m going through R4DS and I liked the ease with which one can map a bar chart in polar coordinates, so thought I’d give it a shot with some temperature data.
Plotting in Polar Coordinates
library(rattle.data)
aus_temp <- weather %>%
select(Date, Temp9am, Temp3pm) %>%
pivot_longer(cols = Temp9am:Temp3pm, names_to="temp", values_to="value") %>%
ggplot(aes(x=Date)) +
geom_line(aes(y=value, color=temp)) +
labs(x="",y="Temperature (Celsius)")
aus_temp + coord_polar()
Less Fun, Easier to Parse
aus_temp + coord_cartesian()
Overall
- I’m a big fan of dplyr and the ability to pipe things together
- Polar Coordinates are cool, but can be more confusing than helpful
Image Credit
Target by Zach Bogart from the Noun Project