gpt4 book ai didi

Markdown /咕噜声 : remove list indices between plots

转载 作者:行者123 更新时间:2023-12-04 08:19:33 25 4
gpt4 key购买 nike

当我编织一个包含通过 purrr:map 函数获得的多个绘图的文档时,我会在每个绘图幻灯片之间获得文本幻灯片,其中包含不需要的列表索引信息(参见图片幻灯片 2、4 和 6)。我想删除这些,只有情节。

  • 我试过 results = "hide"results = FALSE在标题中。
    这些只是返回一个图而不是许多图,并且文本仍然是
    那里。
  • 我已经尝试按照建议在我的代码周围添加 invisible()
    here .我看不出有什么区别。

  • 我怎样才能删除这些,而只有三张幻灯片,三张没有文字的情节?
    powerpoint tray showing alternating plot and text slides
    ---
    title: "Reprex"
    output: powerpoint_presentation
    ---

    ```{r include=FALSE}
    library(tidyverse)
    ```

    ```{r echo=FALSE, results = FALSE}
    ys <- c("mpg","cyl","disp")
    ys %>% map(function(y)
    invisible(ggplot(mtcars, aes(hp)) + geom_point(aes_string(y=y))))
    ```

    最佳答案

    尝试这个:

  • 要抑制控制台输出,请使用 purrr::walk而不是 map .见例如https://chrisbeeley.net/?p=1198
  • 要在单独的幻灯片上打印每个图,请使用 results='asis'并通过 cat('\n\n') 添加两个换行符在每个情节之后。

  • ---
    title: "Reprex"
    output: powerpoint_presentation
    ---

    ```{r include=FALSE}
    library(tidyverse)
    ```

    ```{r echo=FALSE, results='asis'}
    ys <- c("mpg","cyl","disp")
    walk(ys, function(y) {
    p <- ggplot(mtcars, aes(hp)) + geom_point(aes_string(y=y))
    print(p)
    cat('\n\n')
    })
    ```

    enter image description here

    关于 Markdown /咕噜声 : remove list indices between plots,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65554898/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com