Skip to content

Ellipse layout OPTION for plot. #96

Description

@keaven

Feature Idea

Add layout = "ellipse" option to plot.initial_graph()

Background

graphicalMCP::plot.initial_graph() currently plots through igraph::plot.igraph() and supports custom igraph layouts, explicit coordinate matrices, and the package-specific layout = "grid" option. plot.updated_graph() already delegates to plot.initial_graph(), so a new layout option should carry over naturally to updated graphs.

gMCPLite::hGraph() has a useful elliptical arrangement for multiplicity graphs. I would like similar layout functionality in graphicalMCP, while keeping the existing igraph plotting backend rather than introducing a separate ggplot2 plotting path.

Proposal

Add an igraph-based elliptical layout option:

plot(g, layout = "ellipse")
This should compute a coordinate matrix internally and then continue plotting through the existing igraph::plot.igraph() call.
Recommended API
Suggested new arguments to plot.initial_graph():
plot(
  g,
  layout = "ellipse",
  xradius = 2,
  yradius = xradius,
  radian_start = NULL,
  clockwise = TRUE,
  ellipse_vertex_width = NULL,
  ellipse_vertex_height = NULL,
  ellipse_arrow_curvature = NULL
)
Naming can be adjusted to match package style.
Desired behavior
layout = "ellipse" places hypotheses around an ellipse, similar to gMCPLite::hGraph().
xradius and yradius control the width and height of the layout ellipse.
radian_start controls where the first hypothesis is placed. If NULL, use a default similar to gMCPLite::hGraph().
clockwise = TRUE should match the hGraph() convention.
Add support for elliptical vertex sizing, analogous to hGraph()’s halfWid and halfHgt, while still using igraph.If possible, map these to igraph vertex width/height behavior.
If a custom igraph vertex shape is needed for true ellipses, keep it internal and documented.

Carry over the useful arrow spacing/arrangement idea from hGraph(), especially avoiding arrows starting or ending at node centers.
Add a curvature option for connecting arrows in the elliptical layout.Default should preserve the current plot behavior: paired two-way edges use the existing default curvature and other edges are straight.
Users should be able to override this for the ellipse layout without losing the current named edge_curves behavior.

Implementation notes
The preferred implementation is to extend plot.initial_graph() rather than create a separate function. This is a layout addition, and layout is already part of the plotting API.
A separate ggplot2 function should not be added for this issue. The goal is not to reproduce the full gMCPLite::hGraph() rendering engine, but to bring its useful elliptical layout controls into the existing igraph plotting workflow.
Acceptance criteria
plot(g, layout = "ellipse") works for initial_graph.
plot(graph_update(g, ...), layout = "ellipse") works for updated_graph.
Existing layout = "grid", coordinate matrix layouts, and igraph layouts remain unchanged.
Users can control layout ellipse dimensions.
Users can control hypothesis ellipse/vertex dimensions where feasible in igraph.
Arrow curvature defaults match current behavior, with an option to customize curvature for elliptical layouts.
Documentation and tests cover the new layout option.

### Relevant Input

_No response_

### Relevant Output

_No response_

### Reproducible Example/Pseudo Code

_No response_

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions