Skip to content

Should we wrap draw_legend in recordGraphics? #124

@grantmcdermott

Description

@grantmcdermott

Or, at least, wrap the the final return object in recordGraphics(). Would require something like changing lines 360-364 here to:

  if (isTRUE(gradient)) {
    recordGraphics(
      gradient_legend(legend.args = legend.args, lmar = lmar, outer_right = outer_right, outer_bottom = outer_bottom),
      list(legend.args = legend.args, lmar = lmar, outer_right = outer_right, outer_bottom = outer_bottom),
      getNamespace("tinyplot")
    )
  } else {
    recordGraphics(
      do.call("legend", legend.args),
      list(legend.args = legend.args),
      getNamespace("tinyplot")
    )

Reason: This would ensure that the legend spacing (e.g., gaps between groups and labels) is preserved even if we resize the plot. Right now, resizing is kind of annoying because it messes up the spacing of the current plot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions