在R中,使用plot()函数创建基本图形可以通过设置不同的参数来使其更美观。以下是一些建议:
plot(x, y, main = "My Plot", xlab = "X-axis", ylab = "Y-axis")
plot(x, y, col = "white", col.axis = "black")
plot(x, y, col = "white", col.axis = "black")
plot(x, y, col.lab = "black", col.ticks = "black")
plot(x, y, family = "Arial", cex.lab = 1.5, cex.axis = 1.2, cex.main = 2)
plot(x, y, lty = 2, lwd = 2)
plot(x, y, col = "red", main = "My Plot")
legend("topright", legend = "My Data", col = "red", lty = 1)
plot(x, y, main = "My Plot")
abline(h = seq(min(y), max(y), by = 1), v = seq(min(x), max(x), by = 1), col = "lightgray")
plot(x, y, main = "My Plot")
text(x = 3, y = 5, labels = "My Text", col = "blue", cex = 1.2)
plot(x, y, main = "My Plot")
arrows(x0 = 2, y0 = 4, x1 = 4, y1 = 6, length = 0.1, angle = 20, code = 3)
通过以上方法,您可以使用R中的plot()函数创建更美观的基本图形。
领取专属 10元无门槛券
手把手带您无忧上云