Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for a non-interactive network graph for static reporting #1070

Closed
mattwarkentin opened this issue May 10, 2023 · 4 comments
Closed
Assignees

Comments

@mattwarkentin
Copy link
Contributor

Hi @wlandau,

Would you consider supporting a function like tar_visnetwork() that produces a non-interactive graph (ggraph??) that can be easily included in DOCX and PDF reports? Often I want to include the network in reports to walk clients through an analysis, but sometimes/usually the report has to be non-HTML.

I know that the network data itself can be obtained with tar_network() so the user has the option to create their own, but I thought it would be worthwhile to have an internal option to create a non-interactive graph that looks aesthetically similar to the one seen with tar_visnetwork() for consistency. What do you think?

@ginolhac
Copy link

Hello,

What about tar_mermaid() ?
Works great in Quarto docs.

@mattwarkentin
Copy link
Contributor Author

It was my understanding that tar_mermaid() relies on a JavaScript library that wouldn't be supported in non-HTML documents. Is this not the case?

@ginolhac
Copy link

True but it can then rendered as you like it best.
Otherwise there is webshot to convert visnetwork to a png.

@wlandau
Copy link
Member

wlandau commented May 10, 2023

tar_mermaid() itself does not rely on JavaScript because it only outputs the text required to produce a mermaid.js graph. As @ginolhac said, Quarto can render that text, possibly in output formats like pdf and docx.

To render the tar_mermaid() text into a Quarto document, you can programmatically write a {mermaid} code chunk like this:

```{r, results = "asis", echo = FALSE}
cat(c("```{mermaid}", tar_mermaid(), "```"), sep = "\n")
```

Other alternatives like DiagrammeR may have other components like JavaScript, c.f. rich-iannone/DiagrammeR#457 and rich-iannone/DiagrammeR#475.

@ropensci ropensci locked and limited conversation to collaborators May 10, 2023
@wlandau wlandau converted this issue into discussion #1071 May 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants