plot icon indicating copy to clipboard operation
plot copied to clipboard

Convert group levels names to title or sentence case in Plot legend

Open allisonhorst opened this issue 2 years ago • 5 comments

It would be awesome if there was an easy way to update legend labels to (e.g. to title or sentence case) if the original data has them in a less finalized looking case (e.g. from snake or camel case).

In other words, is there a way to simplify changing "group_a" "group_b" "group_c" to "Group A" "Group B" "Group C" in the legend?

allisonhorst avatar Oct 18 '22 22:10 allisonhorst

A smart format function that can be applied to color legend (as tickFormat) and x/y axes labels.

Fil avatar Oct 18 '22 22:10 Fil

@allisonhorst did you mention an R package that does something like this? I could imagine prototyping a function by porting it over in a notebook first

enjalot avatar Oct 18 '22 23:10 enjalot

janitoR

Fil avatar Oct 19 '22 04:10 Fil

Specifically janitor::clean_names()

allisonhorst avatar Oct 19 '22 14:10 allisonhorst

here is an initial prototype in notebook: https://observablehq.com/d/3c2f0cf16948edb5

enjalot avatar Oct 19 '22 17:10 enjalot