ClientScript.RegisterClientScriptBlock
我有此代码,所有方框均为绿色,我可以添加些什么以使方框具有不同的颜色
答案 0 :(得分:0)
您只需要为颜色添加一个因数(x_axis_var)。
boxplot(mtcars$mpg ~ mtcars$cyl,
main = "Box Plot of Mileage vs Number of Cylinders",
xlab = "Number of Cylinders",
ylab = "Miles per Gallon", col = factor(mtcars$cyl))
或提供颜色矢量:
boxplot(mtcars$mpg ~ mtcars$cyl,
main = "Box Plot of Mileage vs Number of Cylinders",
xlab = "Number of Cylinders",
ylab = "Miles per Gallon", col = c("blue","red","green"))