我希望有一个合适的图例缩写,不与图表合并。
这是我的代码:
#install.packages('venneuler')
library(rJava)
library(venneuler)
vd <- venneuler(c(A=0.3, B=0.3, C=1.1, "A&B"=0.1, "A&C"=0.2, "B&C"=0.1 ,"A&B&C"=0.1))
plot(vd)
legend("bottomright", legend=c("A=something A\nB=something different in B\nC=something cool in C\n"), title="Labelling")
这就是我得到的:
标签错误:
你能帮我把长缩写放在维恩图中吗?
答案 0 :(得分:1)
请尝试以下代码:
add_legend <- function(...) {
opar <- par(fig=c(0, 1, 0, 1), oma=c(0, 0, 0, 0),
mar=c(0, 0, 0, 0), new=TRUE)
on.exit(par(opar))
plot(0, 0, type='n', bty='n', xaxt='n', yaxt='n')
legend(...)
}
library(rJava)
library(venneuler)
vd <- venneuler(c(A=0.3, B=0.3, C=1.1, "A&B"=0.1, "A&C"=0.2, "B&C"=0.1 ,"A&B&C"=0.1))
par(mar = c(7, 8, 1.4, 0.2))
plot(vd)
add_legend("topleft", legend=c("A=something A\nB=something different in B\nC=something cool in C\n"), title="Labelling")
我是根据这篇文章写的:Plot a legend outside of the plotting area in base graphics?