I used the following geom_polygon code to create the radar plot below. In this figure, my four treatment (ES, EO, LO, LS) are at the four polygon corners, and my shapes are specific to 4 streams (Blue, Pink, Orange, Yellow). This code produced a four-sized polygon with straight edges. The same dataset is used to create both figures. Table here:
| Substrate | Phase | vf |
|---|---|---|
| Cobble | ES | 3.6 |
| Pea Gravel | ES | 4.5 |
| Mix | ES | 2.1 |
| Sand | ES | 1.9 |
| Cobble | EO | 5.6 |
| Pea Gravel | EO | 6.9 |
| Mix | EO | 3.2 |
| Sand | EO | 2.9 |
| Cobble | LO | 5.9 |
| Pea Gravel | LO | 7.4 |
| Mix | LO | 3.4 |
| Sand | LO | 3.1 |
| Cobble | LS | 1.8 |
| Pea Gravel | LS | 2.3 |
| Mix | LS | 1.1 |
| Sand | LS | 1.0 |
ggplot(data=nh420, aes(x=phase, y=vf, group=substrate, colour=substrate))+ #
annotate("text", x=4, y=c(2,4,6,8,10), label=c(2,4,6,8,10), hjust=0.5, vjust=1)+
geom_polygon(size = 1.5, alpha= 0)+
scale_y_continuous()+
scale_x_discrete()+
scale_colour_manual(values= c("#c55a11", "#ab3378", "#4677aa", "#cbbb44"))+
#scale_fill_manual(values= c("#CA885F", "#B66C98","#4677aa","#cbbb44"))+
#scale_y_continuous(expand=c(0,0),limits=c(0,10),breaks=seq(0,10,3))+
#ylab(expression(NH["4"]~""^"+"-N~V["f"]~(m~d^{"-1"})))+
theme_minimal()+
theme(axis.title.x=element_blank(),
axis.title.y=element_blank(),
#axis.title.y=element_text(size=12,color="black"),
#axis.text.y=element_text(size=10,color="black"),
#axis.text.x=element_text(size=12,color="black"),
axis.text.x=element_blank(),
axis.text.y=element_blank())+
theme(legend.position="none")+
coord_polar(start = -9.5)
However, when I switch around the x variable and grouping to create the inverse figure, the sides of the polygon are now curved. Why the drastic change in shape? The code for the second image (gray and yellow lines) is below.
ggplot(data=nh420, aes(x=substrate, y=vf, group=phase, colour=phase))+ #
annotate("text", x=4, y=0:3, label=0:3, hjust=0.5, vjust=1)+
geom_polygon(size = 1.5, alpha= 0)+
scale_y_continuous()+
scale_x_discrete()+
scale_colour_manual(values= c("gray75", "yellow", "goldenrod", "gray35"))+
#scale_fill_manual(values= c("#CA885F", "#B66C98","#4677aa","#cbbb44"))+
#scale_y_continuous(expand=c(0,0),limits=c(0,10),breaks=seq(0,10,3))+
#ylab(expression("Areal Uptake,"~italic(U)~(mg~N~m^{"-2"}~h^{"-1"})))+
theme_minimal()+
theme(axis.title.x=element_blank(),
axis.title.y=element_blank(),
#axis.title.y=element_text(size=12,color="black"),
#axis.text.y=element_text(size=10,color="black"),
#axis.text.x=element_text(size=12,color="black"),
axis.text.x=element_blank(),
axis.text.y=element_blank())+
theme(legend.position="none")+
coord_polar(start = -9.5)
I do not understand why the shape changes. Any help is appreciated!


I once had this problem but found a custom function/trick on Erwan Le Pennec blog
Step 1: Create a custom radar coordinate system:
Step 2: Add the function to the plot object
Step 3: Optional, rearrange the levels to make it easier to read.
Final Result, hope it helps.