fbreitwieser / sankeyD3

D3 Sankey Network Graphs from R
65 stars 27 forks source link

title on top of nodes #19

Open Krisselack opened 5 years ago

Krisselack commented 5 years ago

I used the title option; but unlike in the docs (topright corner) it moved to the topleft corner (per default) on top of a node. Would be nice to have some vertical distance between title and diagram.

j-johanness commented 4 years ago

First of all, I think this is an amazing package. Thank you so much @fbreitwieser . There are so much more ways to customize the Sankey now, as opposed to when it was first introduced in the 'networkD3' package.

However, I am encountering a similar issue as well, where the title is situated in the top-left hand corner of the plot, and overlapping completely with the nodes/links found there. I have attempted to resolve this using the 'margin' argument, but was unsuccessful.

I share a cropped snapshot of my Sankey.

Capture

My code is as follows;

`margin <- c(top=50,right=50,bottom=50,left=50)

plot3 <- sankeyNetwork(Links = links, Nodes = nodes, Source = "source", Target = "target", Value = "value", NodeID = "name", NodePosX = NULL, NodeValue = NULL, NodeColor = NULL, NodeFontColor = NULL, NodeFontSize = NULL, colourScale = my_color, fontSize = 10, fontFamily = "times-new-roman", fontColor = NULL, nodeWidth = 15, nodePadding = 10, nodeStrokeWidth = 1, nodeCornerRadius = 0, margin = margin, title = "Region 01", orderByPath = FALSE, highlightChildLinks = FALSE, doubleclickTogglesChildren = FALSE, xAxisDomain = NULL, dragX = FALSE, dragY = FALSE, height = NULL, width = NULL, iterations = 0, zoom = FALSE, align = "none", showNodeValues = FALSE, linkType = "path1", curvature = 0.5, nodeLabelMargin = 5, linkOpacity = 0.3, linkGradient = FALSE, nodeShadow = FALSE, scaleNodeBreadthsByString = FALSE, xScalingFactor = 1, yOrderComparator = FALSE) plot3`

Nodeswitch commented 4 years ago

Does anyone know if there's a fix or workaround for this? I'm able to replicate the above.

Thanks!