openpharma / openpharma/graphicalMCP

Ellipse layout OPTION for plot.

Open
#96 0 comments 0 reactions 1 assignee View on GitHub

@keaven is already working on this.

Since Jun 20, 2026.

enhancement
Dominant language
R
Stars
21
Forks
1
Avg merge
4h 27m
Merged PRs (30d)
11

Description

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_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.