Open stormrage009 opened 1 week ago
Here is the code to generate this problem, which I can reproduce in a regular .R
file (not just running the whole chunk at once from .qmd
or similar):
library(ggExtra)
library(ggplot2)
set.seed(30)
df <- data.frame(x = rnorm(500, 50, 10), y = runif(500, 0, 50))
p2 <- ggplot(df, aes(x, y)) + geom_point()
ggMarginal(p2, type = "boxplot")
ggMarginal(p2, type = "histogram")
I took a quick look at ggExtra and I think it has to do with the print method here: https://github.com/daattali/ggExtra/blob/9d91043b5cead332559cbdf874e1bf935af0489e/R/ggMarginal.R#L203
We're not drawing a new page but grDevices::dev.interactive()
looks to evaluate to FALSE
in both RStudio and Positron consoles? Not sure what's going on.
Check out the newpage
behavior:
library(ggExtra)
library(ggplot2)
set.seed(30)
df <- data.frame(x = rnorm(500, 50, 10), y = runif(500, 0, 50))
p2 <- ggplot(df, aes(x, y)) + geom_point()
p <- ggMarginal(p2, type = "boxplot")
print(p, newpage = TRUE)
p <- ggMarginal(p2, type = "histogram")
print(p, newpage = TRUE)
We're not drawing a new page but
grDevices::dev.interactive()
looks to evaluate toFALSE
in both RStudio and Positron consoles? Not sure what's going on.我们没有绘制新页面,但grDevices::dev.interactive()
在 RStudio 和 Positron 控制台中都显示为FALSE
?不知道是怎么回事。Check out the
newpage
behavior:查看新页面
行为:library(ggExtra) library(ggplot2) set.seed(30) df <- data.frame(x = rnorm(500, 50, 10), y = runif(500, 0, 50)) p2 <- ggplot(df, aes(x, y)) + geom_point() p <- ggMarginal(p2, type = "boxplot") print(p, newpage = TRUE) p <- ggMarginal(p2, type = "histogram") print(p, newpage = TRUE)
Thanks for reply.
When i ues code print(p, newpage = TRUE)
, the output is correct.
However, this approach is still a bit cumbersome. Is it possible to fix or improve this issue in future versions of Positron, so that we can output the correct result without using the code print(p, newpage = TRUE)
?
Yep, sure thing @stormrage009! I have moved this issue to triage so we can prioritize when to dig deeper to find the cause and then create a solution.
Yep, sure thing @stormrage009! I have moved this issue to triage so we can prioritize when to dig deeper to find the cause and then create a solution.
Thank you very much for the quick response:)
System details:
Positron and OS details:
Interpreter details:
R 4.4.2
Describe the issue:
When I use the ggExtra and ggplot packages for plotting, the images overlap in the plot viewer when there was another plot in plot viewer already!
Steps to reproduce the issue:
Code to reproduce issue:
Expected or desired behavior:
And the correct output should be two plots: