📜  如何在 r 中使用绘图图例绘制多图 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:08.843000             🧑  作者: Mango

代码示例1
plot_colors <- c("blue","black", "green", "orange", "pink")
  text <- c("Fabricated Metal", "Iron and Steel", "Paper", 
  "Beverages", "Tobacco")
  plot.new()
  par(xpd=TRUE)
  legend("center",legend = text, text.width = max(sapply(text, strwidth)),
         col=plot_colors, lwd=5, cex=1, horiz = TRUE)
  par(xpd=FALSE)