I updated Rstudio and suddently none of my legends are working on my barplots. It’s my first time askign for help on here, so hopefully I am providing the info needed to get answers? Coding is below. The code for the table and the barlplot work fine, but when I add in the legend it says “Error in (function (s, units = “user”, cex = NULL, font = NULL, vfont = NULL, : plot.new has not been called yet”
table(df1$`enc type`, df1$`National or International`)Pet
table(df1$`Age class`, df1$`National or International`)
barplot(table(df1$`Age class`, df1$`National or International`),
main="Age Class of Kiwi",
xlab="Age Class",
ylab="Count",
beside = TRUE,
col = c("black","white","grey")
)
legend("topleft",c("Juvenille","Subadult","Adult"), fill = c("black","white","grey"))
New contributor
Rebecca Connor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.