Hi Radha,
You can change the order of legends in any order using the order attribute within the function of the guide.
Suppose my legends are as below -
ggplot(mpg, aes(displ, hwy, col = cyl)) + geom_point(size = 2,aes(shape = factor(cyl))) + theme(legend.box.margin = margin(0.3,0.3,0.3,0.3,"cm"),legend.background = element_rect(color = "yellow")) + guides(shape = guide_legend(title = "cyl")) + scale_shape_discrete(labels = c("a","b","c","d")) + theme(legend.position = "bottom")
![](https://www.edureka.co/community/?qa=blob&qa_blobid=3062769424818092944)
I change the order using code below -
ggplot(mpg, aes(displ, hwy, col = cyl)) + geom_point(size = 2,aes(shape = factor(cyl))) + theme(legend.box.margin = margin(0.3,0.3,0.3,0.3,"cm"),legend.background = element_rect(color = "yellow")) + guides(shape = guide_legend(title = "cyl")) + scale_shape_discrete(labels = c("a","b","c","d")) + theme(legend.position = "bottom") + guides(shape = guide_legend(order = 2),col = guide_legend(order = 1))
![](https://www.edureka.co/community/?qa=blob&qa_blobid=15577208841910477730)