ggpmisc icon indicating copy to clipboard operation
ggpmisc copied to clipboard

Implement format templates for label assembly in use_label()

Open aphalo opened this issue 3 years ago • 2 comments

I just implemented function use_label() that uses paste() to assemble the combined label and supports a single value for sep. This is a simple user interface usable in many cases. A function fmt_label()could be also useful when users want to have arbitrary separators or additional text. This is to keep a note that if use_label() turns out to be limiting, a function using a template for the overall format would be a reasonable UI, although not necessarily very easy to implement, in particular handling of parsing errors.

aphalo avatar Jul 31 '22 16:07 aphalo

Two possible approaches: 1) create a wrapper on sprintf() that understands the short names of the labels and maps the assembled character vector to the label aesthetic; 2) enhance use_label() to have an interface similar to R's paste(). This does not seem urgent, so I will keep it on hold for some time.

aphalo avatar Aug 06 '23 20:08 aphalo