-3
I would like to understand how I can make the following changes to the chart below:
- Change the Y-axis scale and hide it from the graph if you want
- Place values on top of each bar
- Place the X-axis months in ascending order (June... July.) and bold the writing
I’m using the following script:
library(ggplot2)
library(tidyr)
TCH <- data.frame(Período =c("Jun", "Jul"),
CV6654 = c(9.38, 26.14), CTC9002 = c(16.27, 47.71))
df <- gather(TCH, "Variedades", "Valor", -Período)
ggplot(df, aes(x = factor(Período), y = Valor, fill = Variedades)) +
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values = c("1", "3")) +
labs(x = "Período", y = "")
geom_text
orgeom_label
; 3)x = factor(Período, levels = c("Jun", "Jul"))
.– Rui Barradas
Hello Patrick, welcome to Sopt. A few tips to get your question answered satisfactorily: 1) Be specific about the result you are looking for. Do you want to change the axis scale as? For logarithmic scale? Fraction? Percentage? Without specifying, you will get at most a generic response. 2) Divide your doubts into several posts. Ideally, each question should refer to a single problem. This assists other users when searching for a solution and helps you delimit the steps of your code. Even, if you look for separate steps, you will find answers on the site that may help you.
– Carlos Eduardo Lagosta