Skip to content
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

generate_dot() uses single quotes instead of double quotes #491

Open
atchley-sha opened this issue Jun 30, 2023 · 1 comment
Open

generate_dot() uses single quotes instead of double quotes #491

atchley-sha opened this issue Jun 30, 2023 · 1 comment

Comments

@atchley-sha
Copy link

atchley-sha commented Jun 30, 2023

Using the generate_dot() function, the output uses single quotes around every attribute value, which (as far as I can tell) isn't supported in the dot language. Writing the output of generate_dot() to a file and subsequently running dot from a command line on that file throws a syntax error.

For example:

g <- create_graph() %>%
    add_node() %>%
    add_node() %>%
    add_edge(1,2)

generate_dot(g) %>% writeLines("test.dot")

produces

digraph {

graph [layout = 'neato',
       outputorder = 'edgesfirst',
       bgcolor = 'white']

node [fontname = 'Helvetica',
      fontsize = '10',
      shape = 'circle',
      fixedsize = 'true',
      width = '0.5',
      style = 'filled',
      fillcolor = 'aliceblue',
      color = 'gray70',
      fontcolor = 'gray50']

edge [fontname = 'Helvetica',
     fontsize = '8',
     len = '1.5',
     color = 'gray80',
     arrowsize = '0.5']

  '1'
  '2'
  '1'->'2' 
}

and dot -Tpng test.dot -o test.png from a command line gives Error: test.dot: syntax error in line 3 near '''. However, replacing the single quotes with double quotes (e.g. with str_replace("'", "\"")) produces a file that does work with command-line dot.

It seems to me that generate_dot() should use double quotes by default since that's what dot expects.

@olivroy
Copy link
Collaborator

olivroy commented Nov 16, 2023

Other double quotes / single quotes issues #433, #432, #441

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

2 participants