4/17/2023 0 Comments Ggplot rename x ticks labels![]() ![]() In another post I read the advice to use xaxt="n", but I cannot get that to work with ggplot2. If we want to keep the x-axis tick labels horizontal but stop the text from overlapping we can use strwrap(), which wraps text to a specific number of. ![]() I also tried levels=c(1,2,3,4,5) and labels=c("1 hour", "4 hours", etc) butĪll I get is an empty x-axis, no new labels. rcParamsaxes.propcycle)2color) ax3.setxticks(x + width, labelsa, b, c, d, e) circles with colors from default color cycle for i. I searched this site and google and came up with this code: plot1 <- plot + scale_x_discrete(labels=c("1"="1 hour", "2"="4 hours", "3"="8 hours", "4"="POD1 Morning", "5"="POD1 Afternoon")) how to increase x-axis tick labels in ggplot2 x axis ticks labels ggplot r ggplot change tick labels r ggplot x ticks size ggplot increase size of axis tickes and labels ggplot change axis tick labels axis ticks and labels ggplot ggplot axis tick label size remove x-axis and y-axis label increase x axis ticks and label in ggplot2. I would like to replace 1, 2, 3, 4, 5 on the x-axis with the labels 1 hour, 4 hours, 8 hours, POD1 Morning and POD1 Afternoon. With several commands, I adjusted the graph to my liking and I have this: I am quite new to R and I am trying to create a spaghetti plot to compare in 4 groups the percentage of patients taking rescue medication, at different timepoints (1 hour after surgery, 4 hours, 8 hours and post-operative day 1 morning and post-operative day 1 afternoon).Īfter playing around, I created a decent graph, starting from this code: plot <- ggplot(data=rescue, aes(Measurement, Percentage, color=factor(Group))) + geom_line()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |