首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Generation中的in图生成大型图形描述

用Generation中的in图生成大型图形描述
EN

Stack Overflow用户
提问于 2021-09-08 02:15:39
回答 1查看 245关注 0票数 2

我需要有一个长的描述,是附加在我的图形底部,左对齐,最好是我想要直接在R标记文件这一点。我正在编织PDF。是否有一个只适用于这类任务的包?

这是我试图复制的图形类型:

有些事我试过了:

使用labs()的标题参数的

代码语言:javascript
复制
ggplot(data, aes(x = x, y = y) +
  geom_point() +
  labs(caption = "Really long figure description")

这不能包装文字。

使用ggpubr::ggarrange

代码语言:javascript
复制
p <- ggplot(data, aes(x = x, y = y) +
  geom_point() +
ggarrange(p, bottom = "Really long figure description")

这也没有包装文本。

  1. ,类似于块头中的内容:

代码语言:javascript
复制
{r, fig.cap = "\\label{fig:myfigure} Here be your caption text"}
    generate_a_figue(my_data)

这根本不会改变输出。

是否有一种方法可以遵循R标记的精神,避免在LaTeX文件中乱搞?

EN

回答 1

Stack Overflow用户

发布于 2021-09-08 06:36:08

长图标题有点笨重,但您可以将全部内容作为fig.cap参数放在头文件中,如下所示。行中断效果可以包含在两个转义反斜杠:\\\\中。

对于加分,如果要将其包含在TOF中,可以提供一个简短的标题:

代码语言:javascript
复制
```{r irisfig, echo=F, fig.cap='First line of a figure caption, \\\\ followed by an incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, incredibly, long figure caption.'  , fig.scap='Short caption for the TOC'}

图书馆(Ggplot2)

ggplot 2::ggplot2(虹膜,aes(Sepal.Length,Sepal.Width))+ )

geom_point()

代码语言:javascript
复制

产生的结果:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69096233

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档