Open krlmlr opened 8 years ago
I've considered this indeed but haven't come up with a way to do this even with basic plot
. I'll try more.
Still not working for me... We can't rely on scale_x_continuous(labels = format)
, when the labels are computed the class is lost already. I think this has to be fixed at the ggplot2 side?
library(tidyverse)
my_format <- function(x) {
print(x)
format(x)
}
data.frame(x = formattable::percent((1:10) / 100), y = 1:10) %>%
ggplot(aes(x = x, y = y)) %>%
+ geom_point() %>%
+ scale_x_continuous(labels = my_format)
#> [1] NA 0.025 0.050 0.075 0.100
Created on 2020-06-12 by the reprex package (v0.3.0)
Yes, I guess the plot function has to use the format string as the label rather than numeric value, or otherwise I guess I can do nothing about it.
Attaching formatting to values is a very neat approach. Any thoughts on making this compatible with ggplot? Example:
I would expect the formatting to show up on the axes.