i have run the following code yet what is inside the "theme" function doesn't work (it does not change the legend title nor the axis title). Could anyone help fix this problem ?
ggplot()
geom_line(aes(x = PGS_evol_type$année,
y = PGS_evol_type$nb_amb,
color = PGS_evol_type$Type_amb,
group = 1))
geom_line(aes(x = PGS_evol_type$année,
y = PGS_evol_type$nb_hosp,
color = PGS_evol_type$type_hosp,
group = 1))
geom_line(aes(x = PGS_evol_type$année,
y = PGS_evol_type$nb_ext,
color = PGS_evol_type$type_ext,
group = 1))
theme(axis.title.y = element_text("nombre de séjour"),
axis.title.x = element_text("année"),
legend.title = element_text("type de séjour"))
CodePudding user response:
Putting the comments together, your code would look something like this:
ggplot(PGS_evol_type)
geom_line(aes(x = année, y = nb_amb, color = type_amb, group = 1))
geom_line(aes(x = année, y = nb_hosp, color = type_hosp, group = 1))
geom_line(aes(x = année, y = nb_ext, color = type_ext, group = 1))
labs(y = "nombre de séjour", x = "année", color = "type de séjour")
# Theme is used for changing the look of objects, for example
theme(
axis.title.x = element_text(face = "bold", size = "14"),
axis.title.y = element_text(face = "italic", size = "12")
)