Skip to content

unexpected units error when plotting with small fig.width in Rmarkdown #176

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

Closed
ha0ye opened this issue May 1, 2019 · 0 comments
Closed

Comments

@ha0ye
Copy link

ha0ye commented May 1, 2019

I'm writing a function to generate network figures, and it's sometimes giving me an unusual error. I couldn't exactly place what exactly was causing the error.

The message I'm getting is:

Error in unit(x_new, "mm") : 'x' and 'units' must have length > 0
Calls: <Anonymous> ... makeContent -> makeContent.cappedpathgrob -> grob -> unit
Execution halted

which seems related to having long node names, and trying to draw nodes and edges in a certain way.

Here's a small reprex (in the form of an Rmarkdown chunk)

```{r, fig.width = 3}
df <- tibble::tribble(
    ~from,  ~to,
    "a",    "b",
    "c",    "asdfasdfasdfasdfasdfasdfadsf")

my_graph <- igraph::graph_from_data_frame(df)

ggraph(my_graph, layout = "circle") +
    geom_edge_link(start_cap = circle(0.3, "inches")) +
    geom_node_circle(aes(r = 0.08, fill = name)) +
    coord_fixed()
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant