Open serkserk opened 6 years ago
You could look into the GraphViz Splines attributes and play around with some of the different splines settings.
pt <- eventdataR::patients
spline <- c("none", "line", "polyline", "curved", "ortho", "spline")
graph <- processmapR::process_map(pt, fixed_edge_width = TRUE,
render = F,
rankdir = "LR")
model <- DiagrammeR::add_global_graph_attrs(graph,
attr = "splines",
value = "ortho",
attr_type = "graph")
processanimateR::animate_process(pt, model, mode = "off")
Hope that helps
Thank you, The labels position is not ideal, but now I know where to search so I can figure it out.
Edit: it doesnt seems to keep the order I set with fixed_node_pos
Edit 2 : I cant change most of the attribute with diagrammeR::add_global_graph_attrs()
visual stuff like node shape, node fillcolor etc. beside edge arrowsize and color
@fmannhardt any ideas?
The issue is that the fixed_node_pos
option forces DiagrammeR to use the neato
layout engine since this is the only engine of GraphViz that supports pinning down (all) nodes to fixed positions. Unfortunately the edge routing options are only whether to use spline or not as follows:
library(eventdataR)
library(processmapR)
positions <- data.frame(act = c("Registration","Triage and Assessment","Blood test", "MRI SCAN", "X-Ray", "Discuss Results", "Check-out", "Start", "End"),
x = c(2,4,6,7,6,9,11,0,14),
y = c(0,0,-1,0,1,0,0,0,0),
stringsAsFactors = F)
graph <- process_map(patients,
fixed_node_pos = positions,
render = F)
graph <- DiagrammeR::add_global_graph_attrs(graph,
attr = "splines",
value = "true",
attr_type = "graph")
DiagrammeR::render_graph(graph)
Hopefully this helps. Probably that should be added in the parameter documentation as warning. I searched a bit for alternatives, but could not find any good auto layout with some nodes at fixed positions.
Hi,
I tried the recently added
fixed_node_pos
parameter, and it worked fine with the patient example in another issue but when I tried it with my data that have self edge or multiple edges going to multiple nodes, everything get stacked and the edge values get behind. Any way to control the edges ? Maybe adding more curve to the edges would fix this.Edit; this is how it is by default But even when trying another kind of disposition, it still make straight edges: