具有分类 X 轴的箱线图图例的坐标
Coordinates of A Boxplot Legend with Categorical X-Axis
我有一个包含 2 个条的箱线图:
boxplot(mtcars$mpg,mtcars$qsec)
我想使用坐标在右下角添加图例。
我怎么知道下面图例函数 (x) 的 x,y 坐标的 x 值是多少?
legend(x,15,legend=c("mpg","qsec"))
为什么要使用坐标?如果放弃该条件,则很容易:改用名称“bottomright”,即
legend("bottomright", legend = c("mpg","qsec"))
如果您不希望它恰好位于角落,您可以使用 inset
参数,例如
boxplot(mtcars$mpg,mtcars$qsec)
legend("bottomright", legend = c("mpg","qsec"), inset = c(0.01, 0.02))
由 reprex package (v1.0.0)
于 2021-03-26 创建
我有一个包含 2 个条的箱线图:
boxplot(mtcars$mpg,mtcars$qsec)
我想使用坐标在右下角添加图例。 我怎么知道下面图例函数 (x) 的 x,y 坐标的 x 值是多少?
legend(x,15,legend=c("mpg","qsec"))
为什么要使用坐标?如果放弃该条件,则很容易:改用名称“bottomright”,即
legend("bottomright", legend = c("mpg","qsec"))
如果您不希望它恰好位于角落,您可以使用 inset
参数,例如
boxplot(mtcars$mpg,mtcars$qsec)
legend("bottomright", legend = c("mpg","qsec"), inset = c(0.01, 0.02))
由 reprex package (v1.0.0)
于 2021-03-26 创建