I have a basic bar graph I\'ve created from ggplot2. The y variable contains both positive and negative values and about half the vector of values are negative. I would like
I, too, get the warning message mentioned in @Mark Neal's comment; it makes me nervous. Here's an alternative approach with the ggtext
package. You can wrap the categories for the x-axis in s and specify the color you want, and then use
element_markdown
in the theme:
library(ggtext)
library(tidyverse)
data %>%
mutate(x.label = paste("",
x,
"", sep = ""),
x.label = fct_reorder(x.label, as.character(x))) %>%
ggplot(aes(x=x.label, y=y)) +
geom_bar(stat = "identity", aes(fill=category)) +
theme(axis.text.x = element_markdown(angle = 45, hjust = 1))