簡體   English   中英

如何使 R 中的歐拉 plot 中的圖例水平?

[英]How can I make the legend horizontal in the euler plot in R?

我很難設計這個歐拉 plot。 我的主要問題之一是我希望圖例位於底部,但水平顯示變量。 它們垂直堆疊起來看起來很奇怪。

如果有人也知道如何調整邊距,在整個 plot 周圍添加一個邊框,並添加一個字幕,我也被這些東西難住了。 我已經嘗試過 par(mar) 並且沒有任何效果。

fit1 <- euler(c("Day 1" = 69, "Day 2" = 109, "Day 3" = 152,
                "Day 1&Day 2" = 11, "Day 1&Day 3" = 18, "Day 2&Day 3" = 28,
                "Day 1&Day 2&Day 3" = 2))

col <- c("#66D2D6", "#FBC740", "#E56997")

plot(fit1,
     quantities = TRUE,
     fills = list(fill = col, alpha = 0.8),
     edges = "black",
     main = list(label = "test", cex = 0.9),
     legend = list(side = "bottom"))

在此處輸入圖像描述

euler對象的plot方法使用grid::grid.legend()到 plot 圖例。 您可以在 plot 的legend參數中指定任何grid.legendplot (實際上調用plot.euler )。 要獲得水平圖例,請使用

plot(fit1,
     quantities = TRUE,
     fills = list(fill = col, alpha = 0.8),
     edges = "black",
     main = list(label = "test", cex = 0.9),
     legend = list(side = "bottom", nrow = 1, ncol = 3))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM