Reputation: 421
I am wanting to get the cleanest look using this code chunk which overlays my plot in R
legend(130, 0.0150, legend = c(paste0("Large diameter ", format(center, digits=6)),
paste0("Minimum ", format(min2, digits=6))),
bty = "n")
Notice the large white spaces. But this achieves the effect I want
But I know there's a better way to do this! I additionally want to add more descriptive statistics to the plot and this has to be a very inefficient way of doing it. So, what's the best way to align the text and numbers? Any way to beautify to this further? Thanks all!
Upvotes: 2
Views: 49
Reputation: 72623
You could just print two legends side by side.
Example
Example plot:
curve(cos(x)/100, xlim=c(0, 250), ylim=c(0, .02), col="blue")
center <- 135.873; min2 <- 86.3301 # values
Legend:
legend(130, 0.0150, legend=c("Large diameter", "Minimum"), bty="n")
legend(200, 0.0150, legend=c(format(center, digits=6),
format(min2, digits=6)), bty="n")
Upvotes: 2