1
plot(prey$snake.SVL, prey$prey.weight, col = prey$snake.id, pch = 20, cex = 2)
此圖顯示了SVL(蛇的長度)VS獵物重量pr.snake.id:
的問題是我如何獲得每條蛇的顏色?
plot(prey$snake.SVL, prey$prey.weight, col = prey$snake.id, pch = 20, cex = 2)
此圖顯示了SVL(蛇的長度)VS獵物重量pr.snake.id:
的問題是我如何獲得每條蛇的顏色?
library(ggplot2)
ggplot(data = snake.svl, aes(x = snake.svl,y = prey.weight, col = snake.id)) + geom_point()
ggplot可能是更好的陰謀打賭。
library(ggplot2)
ggplot(snake.svl,aes(x=snake.svl,y=prey.weight))+geom_point(aes(color=snake.id))
這可能不完全正確,但它應該可以幫助您開始。
重點是ggplot和geom_point會給你你想要的。
在繪圖之前設置調色板(彩虹(長度(獨特(獵物$ snake.id))))。我認爲'調色板(「默認」)只有8種顏色。 – lukeA