Open AprilPeck opened 4 years ago
You can add a dumbbell using segments:
segments( x0=1920, x1=1925, y0=5 )
points( c(1920,1925), c(5,5), pch=19 )
https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/segments.html
Thanks, @lecy! @AprilPeck, as counter-intuitive as it may seem, I would recommend against using the legend function and instead using the "dumbbell" code @lecy provided, as well as function text()
, with the correct coordinates, to create a custom lab. Like how we discussed the use of plot()
and the defaults elements it provides, legend()
can be slightly restrictive compared to inserting custom graphical elements with points()
, segments()
, and text()
.
If legend()
works for you, though, all the better!
Thank you!
I'm down to just 2 questions left on Lab 3!
legend("topleft", legend = "League Average", col = "steel blue",pch = 16, lwd = 3, bty = "n", xjust = 0, text.col = "steel blue", cex = 1.5,)