简体   繁体   English

R 维恩图错误 - R 不打印我的维恩图

[英]R Venn diagram error - R does not print my Venn Diagram

I installed the VennDiagram package in R and used the following code to draw a Venn Diagram, however when I run the code, I do not get the plot, but only the output of [1] in the console. I installed the VennDiagram package in R and used the following code to draw a Venn Diagram, however when I run the code, I do not get the plot, but only the output of [1] in the console. Does the problem lie in how R reads my code, as R does not report any error in my code?问题是否在于 R 如何读取我的代码,因为 R 在我的代码中没有报告任何错误? It just does not print my chart in the pane on the right-hand side.它只是不会在右侧窗格中打印我的图表。 My code is as follows: ...我的代码如下: ...

activity_ids <- unique(daily_activity$id, incomparables = FALSE)
sleep_ids <- unique(sleep_day$id, incomparables = FALSE)
steps_ids <- unique(hourly_activity$id, incomparables = FALSE)
heartrate_ids <- unique(heart_rate$id, incomparables = FALSE)

venn.diagram (x = list(activity_ids, sleep_ids, steps_ids, heartrate_ids),
         category.names = c("Activity", "Sleep", "Steps", "Heartrate"),
         filename= "venn_diagram.png",
         output=TRUE, imagetype = "png",
  lwd = 2, fill = c("orange", "red", "green", "blue"),
  cex = 2, fontface = "bold", fontfamily = "sans",
  cat.col = c("orange", "red", "green", "blue"), cat.cex = 2, cat.default.pos = "outer")

Apparantly, the venn.diagram function in the VennDiagram package does not produce a plot on your plotting device (the "Plots" tab in RStudio).显然, venn.diagram package 中的VennDiagram function 不会在您的绘图设备上生成 plot。 Instead, the plot gets written into the file you specified.而是将 plot 写入您指定的文件中。 In your working directory, there should be a file named "venn_diagram.png".在您的工作目录中,应该有一个名为“venn_diagram.png”的文件。

BTW, I could not reproduce your example, since I don't have the daily_activity dataset.顺便说一句,我无法重现您的示例,因为我没有daily_activity数据集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM