I have a box plot using ggplot
which lists the data labels, but am not able to bring a comma separator for 1000s in the data label. sep =","
in aes
doesn't seem to do the trick.
ggplot(based,aes(x=Cust=Claim.USD)) +
geom_boxplot() +
geom_text(data=subset(based,USD>10000), aes(label=USD, sep=","),
hjust=1, vjust=1)+
scale_y_continuous(labels=comma)
On the Layout tab, in the Labels group, click Data Labels, and then click the option that you want. For additional data label options, click More Data Label Options, click Label Options if it's not selected, and then select the options that you want.
Press with mouse on Add Data Labels". Double press with left mouse button on any data label to expand the "Format Data Series" pane. Enable checkbox "Value from cells". A small dialog box prompts for a cell range containing the values you want to use a s data labels.
In machine learning, data labeling is the process of identifying raw data (images, text files, videos, etc.) and adding one or more meaningful and informative labels to provide context so that a machine learning model can learn from it.
The comma
function is in the scales
package, which you'll need to load. Also get rid of sep
, that's not an aesthetic mapping. This should work:
library(scales)
ggplot(based,aes(x=Cust=Claim.USD)) +
geom_boxplot() +
geom_text(data=subset(based,USD>10000), aes(label = comma(USD)),
hjust=1, vjust=1)+
scale_y_continuous(labels = comma)
Judging by your argument names, you might prefer scales::dollar
instead of scales::comma
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With