I am trying to bold some of the name in the x-axis. For example,
fruits = c("apple", "orange", "watermelons")
juice_content = c(10, 1, 1000)
weight = c(5, 2, 2000)
df = data.frame(fruits, juice_content, weight)
df = gather(df, compare, measure, juice_content:weight, factor_key=TRUE)
plot = ggplot(df, aes(fruits, measure, fill = compare)) +
geom_bar(stat = "identity", position = position_dodge())
I want the label orange
be bold in the x-axis.
Edit. With the helps from the comment, I am able to get the x-axis bolded. However, I am not able to compare the two lists.
Here we have
fruits = c("apple", "orange", "watermelons")
let's say that this list has become longer: fruits = c("apple", "orange", "watermelons","pears","banana","mango")
and we have another shorter list of fruits list: short_fruit=c("orange","apple","mango")
How can I compare them?
I tried vec_fontface <- ifelse(fruit == short_fruit,"bold","plain")
but it doesn't seems to work.