cant find issue in legend code

legend(x = -0.05, y = 300, legend=c("Gray", "Red"), col = c("purple2", "red2"), pch = 19, cex = 0.8)

hello :slight_smile: i am having trouble running this code in r it worked for a larger group but wont work like this..

Please help :frowning:

Is there a plot that goes with this legend?

Can you provide a reproducible example?

here is the code from the plot i have generated.

plot(x = mydat2$latL, y = mydat2$latRG, xlab = "Lateral Luminance Colour", ylab = "Lateral Red-Green Colour")

thank you for your time : )

We don't have access to mydat2, hence why a reproducible example would be good. See the article.

The problem with your legend might be with the position of it though. Try playing around with these x = -0.05, y = 300. They should reflect the x and y limits on your graph.

thank you will try that. i am new to r so have no idea whats going on haha

Have a look at ggplot2 as well. It is probably the most commonly used package for graphs in R.