yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.37k stars 874 forks source link

Multiline legend entries with tikzDevice #2244

Open potash opened 1 year ago

potash commented 1 year ago

By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

I don't totally understand the toolchain that allows me to render a ggplot2 figure using tikz in Rmarkdown so this might not be the right repository for this question. But I would like to use multiline text in a legend entry for a figure that is rendered with with this toolchain. Reading up on tikz, it seems that the way to do this is to add the align=left option to the text node and then use \\ to indicate a line break. So my question is: is there a good way to add align=left to the legend entry nodes in an automated way that will work with knitr?

cderv commented 1 year ago

Can you share an example of a document with a ggplot2 and where you use the tikz device ? This will help understand what is the issue here.

For a generic question, you can go to https://community.rstudio.com or other Q&A forum maybe too.