grunwaldlab / grunwaldlab/metacoder

Thoughts on heat_tree argument formats

Open
#260 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
148
Forks
30
PR merge metrics
No merged PRs in 30d

Description

heat_tree has too many arguments for one function (>50) and there are still others I would like to add. Although this does not affect how it works, it is not great UI design. Making the arguments more modular, would give me more freedom to add things. I was thinking about different ways to split up the arguments and I came up with the following options:

Don't change

This is the easiest!

heat_tree(obj,
          node_size = n_obs,
          node_size_interval = c(5, 50),
          node_size_range = c(0.01, 0.02),
          node_size_trans = "linear",
          make_node_legend = FALSE,
          node_size_axis_label = "# OTUS",
          layout = "fr",
          initial_layout = "re",
          title = "my plot",
          title_size = 0.01,
          output_file = "my_plot.pdf")

Imitate ggpllot2's syntax somewhat

Probably the hardest to implement, but takes the least typing for the user. Documentation would be a bit harder to find and people might confuse it with ggplot2 and try to add ggplot2 things like theme (which would sometimes work, if added to the end, making it more confusing).

heat_tree(obj) +
  node_size(n_obs, interval = c(5, 50), range = c(0.01, 0.02), trans = "linear", legend = FALSE, label = "# OTUS") +
  ht_layout("fr", initial = "re") +
  ht_title("my_plot", size = 0.01) +
  ht_output("my_plot.pdf")

Using helper functions

This would be easier to implement, and be more straight-forward to document and discover the documentation.

heat_tree(
  node_size = ht_aes(n_obs, interval = c(5, 50), range = c(0.01, 0.02), trans = "linear", legend = FALSE, label = "# OTUS"),
  layout = "fr",
  initial_layout = "re",
  title = "my plot",
  title_size = 0.01,
  output_file = "my_plot.pdf")

Any thoughts @grunwald, @knausb, @Neato-Nick, @grabear? Thanks!

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.

Research direction

Start by reviewing the heat_tree entry point and its existing arguments, then compare the three proposed API formats in the issue. Done requires a decided modular argument design and an implementation that preserves current behavior while allowing additional options.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.