grantmcdermott / grantmcdermott/tinyplot

Support direct labels for `type_barplot` & co.?

Open
#471 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
427
Forks
25
Avg merge
22h 54m
Merged PRs (30d)
28

Description

Follow up from #469:

I wonder if we shouldn't support a type_barplot(label = TRUE) argument that would add these labels directly?

Apart from requiring less typing than the current, manual plt_add(type = "text", ...) approach, this would also be easier to integrate with dodged barplots where beside = TRUE. At least, in principle.

But also see @zeileis's reply:

Yes, maybe. Although one argument wouldn't be enough, would it? We would need to decide whether we want to display

  • absolute and/or (conditional) relative frequencies
  • ...or use some other formatter, e.g., for adding custom prefixes, suffixes, rounding, etc. (especially for other aggregation FUNctions)
  • at the top or bottom or center of the box
  • whether to adjust or modify the position
  • what cex or col to use for the text (or possibly other font properties)
  • ...

In short, this is not so trivial, unfortunately.

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 reading issue #469 and the existing type_barplot interface, including how plt_add(type = "text", ...) is currently used with beside = TRUE. Before implementation, define the label data and formatter options, placement, adjustment, and text styling; done means those API decisions are documented and the resulting behavior is covered for the relevant barplot cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.