Change axis labels in ggplot

By default, ggplot uses the variable name as the axis labels. Change it to something else using scale_x_continuous or scale_y_continuous


p = ggplot(diamonds)+geom_point()+aes(x=carat,y=price)

p + scale_x_continuous('x axis label') + scale_y_continuous('y axis label')

1 Response to “Change axis labels in ggplot”


Leave a Reply