Open agila5 opened 1 year ago
Another idea in this regard would be to copy the approach adopted by plot.igraph
:
The first method is to supply named arguments to the plotting commands: plot.igraph, tkplot or rglplot. Parameters for vertices start with prefix ‘vertex.’, parameters for edges have prefix ‘edge.’, and global parameters have no prefix. Eg. the color of the vertices can be given via argument vertex.color, whereas edge.color sets the color of the edges. layout gives the layout of the graphs.
Is your feature request related to a problem? Please describe. I think it might be nice if we slightly change
plot.sfnetwork
to include the possibility of defining different args to plot nodes and edges. Currently, we simply pass the samedots
argument to both plotting routineshttps://github.com/luukvdmeer/sfnetworks/blob/23a4125030178f5c42ebb48d2547052a31a3cdea/R/plot.R#L48-L61
which implies that, for example, in the following situation the nodes are coloured in a "weird" way (since the vector 1:3 is recycled to c(1:3, 1) to match the number of nodes. That also explains why two nodes are coloured as black):
Created on 2023-07-28 with reprex v2.0.2
Describe the solution you'd like Add the possibility to specify certain arguments just for the nodes or just for the edges (or maybe it's already possible but I'm not sure how...). I'm also not sure about the interface but I was thinking about something like
where
c(node_args, dots)
are the arguments passed to the plotting routine for the nodes andc(edge_args, dots)
are the arguments passed to the plotting routine for the edges.Describe alternatives you've considered Just build the plot manually layer by layer.