Im trying to change in ggplot2 ylim axis to minus signs (−) instead of hyphens (-). I tried many different options but still it does not show − sign and numbers in a plot..
plot <- ggplot(df_1, aes(x=t, y=RMS, color=Outcome,
fill=Outcome, shape=Outcome))
plot <- plot + scale_y_continuous(limits=c(-0.02, 0.02),
breaks=seq(-0.02, 0.02, by=0.01),
labels=c("−0.02", "−0.01", "0", "0.01", "0.02"))
You could use the unicode glyph \u2212. Just swap it in using a custom labelling function inside scale_y_continuous
ggplot(data.frame(x = letters[1:5], y = seq(-0.2, 0.2, 0.1)), aes(x, y)) +
geom_point() +
theme_gray(base_size = 20) +
scale_y_continuous(breaks = seq(-0.2, 0.2, 0.1),
labels = ~sub("-", "\u2212", .x))

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