library(ggplot2) # ggplot2_2.2.1
# data
df1 <- data.frame(a = c("sensor 1","sensor 2","sensor 3","sensor 4",
"sensor very very long text 5",
"sensor 6","sensor 7","sensor 8"),
b = c(50, 60, 70, 20, 90, 110, 30, 100))
# basic polar bar plot
gg1 <- ggplot(df1, aes(x = a, y = b, fill = a)) +
geom_bar(width = 1, stat="identity") +
coord_polar()
# Accepted answer, it is rotating not curving
# set the angles for each text
myAng <- seq(-20, -340, length.out = 8)
# then update theme with angle
gg1 +
theme(axis.text.x = element_text(size = 12, angle = myAng))
You might want to look at Circular Visualization in R by Zuguang Gu.
The text section seems to have a few different methods that would fit the bill for you!
Great, I have been through that package, was checking these examples, didn't see the cookbook, thank you. Will try to adopt and maybe add answer at SO.
Looking at the code for coord_polar(), it seems like it only affects geom positioning. That's probably for the best: although curved text sounds like a great idea, I'd imagine most other geoms (like lines and points) you wouldn't want to size or curve around the axis. It could lead to even more perceptual problems than polar plots already have
Did anyone ever find a gg_ based solution to this? I have the same problem.
There are two packages that purport to do it, circlize and plotrix. Both of them make R base graphics that are then hard to combine with ggplots (especially if you want to output as SVG). In addition, neither of them support plotmath expressions in text.
I put a feature request for this on the ggplot2 github issues. If anyone has a better solution, I'd appreciate it.