
For example to remove all axis ticks, use this: p + theme(axis.ticks = element_blank()). To remove a particular axis text or ticks, use element_blank() for the corresponding theme argument. Modify the appearance and the rotation angle of axis texts.
element_text(color, size, face, family, angle, hjust, vjust). # Change axis ticks line: font color, size, linetype and lengthĪxis.ticks = element_line(), # Change ticks line fo all axesĪ = element_line(), # Change x axis ticks onlyĪ = element_line(), # Change y axis ticks onlyĪ = unit(3, "pt") # Change the length of tick marks # Change axis ticks text labels: font color, size and faceĪxis.text = element_text(), # Change tick labels for all axesĪ = element_text(), # Change x axis tick labels onlyĪ.top = element_text(), # x axis tick labels on top axisĪ = element_text(), # Change y axis tick labels onlyĪ.right = element_text(),# y axis tick labels on top axis Key ggplot2 theme options to modify the axis line, axis ticks and tick text labels:. The scale functions take the arguments breaks, labels and limits as inputs. Customize continuous x and y axes, respectively. scale_x_continuous() and scale_y_continuous().
Customize discrete x and y axes, respectively.
scale_x_discrete() and scale_y_discrete().theme( = element_text(), = element_text()).The following function will be used to modify the axis theme and scale: