-
Notifications
You must be signed in to change notification settings - Fork 246
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
Non English characters do not appear #124
Comments
One solution is to use html codes. library(DiagrammeR)
grViz("
digraph a_nice_graph {
graph [compound = true, nodesep = .5, ranksep = .25,
color = crimson]
# node definitions with substituted label text
node [fontname = Helvetica, fontcolor = darkslategray,
shape = rectangle, color = darkslategray]
edge [color = grey, arrowhead = none, arrowtail = none]
a [label = '@@1']
Ba [label = '@@2-1']
Bb [label = '@@2-2']
Bc [label = '@@2-3']
# edge definitions with the node IDs
a -> {Ba Bb Bc}
}
[1]: 'A - 10 (2 α π μ τ)'
[2]: 10:12
") |
@sdc3 That's a really great solution... Now I'm wondering if there should be a unicode to html code translator in place to facilitate this. |
If you use the graph functions (really not that hard to use, once you get going on it), unicode characters are supported: library(DiagrammeR)
# Create a node data frame
nodes <- create_nodes(nodes = c("α", "β", "γ", "δ",
"ε", "ζ", "η", "θ",
"ι"),
label = TRUE,
type = c("Χ", "Χ", "Χ", "Χ",
"Ψ", "Ψ", "Ψ", "Ω",
"Ω"),
color = c("blue", "blue",
"red", "red", "pink",
"blue", "pink", "red",
"pink"),
width = c(1.3, 0.7, 1.3, 0.8,
1.1, 0.9, 1.8, 1.1,
1.2),
value = c(182, 98, 182, 112,
154, 126, 252, 154,
168))
# Create an edge data frame
edges <- create_edges(from = c("α", "β", "ι", "ε", "η", "ζ", "θ", "δ", "δ"),
to = c("β", "ι", "ε", "θ", "θ", "θ", "γ", "γ", "α"),
rel = c("rel_a", "rel_a", "rel_b", "rel_c",
"rel_b", "rel_a", "rel_b", "rel_c",
"rel_c"))
# Create a graph object
graph <- create_graph(nodes_df = nodes,
edges_df = edges)
# Render to graph object to the RStudio Viewer panel
render_graph(graph, output = "graph")
render_graph(graph, output = "visNetwork") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An example:
I have tried grViz(enc2utf8(...)) and grViz(iconv(..., to ="utf8")) without success.
What should I do in order to see multilingual text on DiagrammeR?
grViz("
digraph a_nice_graph {
graph [compound = true, nodesep = .5, ranksep = .25,
color = crimson]
node definitions with substituted label text
node [fontname = Helvetica, fontcolor = darkslategray,
shape = rectangle, color = darkslategray]
edge [color = grey, arrowhead = none, arrowtail = none]
a [label = '@@1']
Ba [label = '@@2-1']
Bb [label = '@@2-2']
Bc [label = '@@2-3']
edge definitions with the node IDs
a -> {Ba Bb Bc}
}
[1]: 'A - 10 (2 από 5 θέματα)'
[2]: 10:12
")
The text was updated successfully, but these errors were encountered: