Adding ledgend to a plot

I cannot changethe default position of legend of this plot.

ggline(data = A,x="time",y="survival",
group="Concentration",color = "Concentration",add = c("mean_sd"),
xlab = "Time(hpf)",ylab = "Survival(%)",
theme_bw(),
palette =c("#CC0066","green","#FFFF00","#000999","#66CCFF","#FF9900","#FF0000"),
linetype = "solid")

Try something like

p <- ggline(data = A,x="time",y="survival",
group="Concentration",color = "Concentration",add = c("mean_sd"),
xlab = "Time(hpf)",ylab = "Survival(%)",
theme_bw(),
palette =c("#CC0066","green","#FFFF00","#000999","#66CCFF","#FF9900","#FF0000"),
linetype = "solid")
ggpar(p, legend = "top")

The documentation for the legend argument of ggpar says:
"character specifying legend position. Allowed values are one of c("top", "bot-
tom", "left", "right", "none"). To remove the legend use legend = "none". Leg-
end position can be also specified using a numeric vector c(x, y)"

Thank you so much. Got it sorted.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.