on-internet
← Community

ggplot2 puts legend text next to vertical colour bar, but is there a way to add text to top and bottom?

Stack Overflow ·

I have plots with gradient colourbar, that the numbers dont really mean anything, just the relative amount does, so I replaced the tick text with descriptions. however, ggplot2 puts legend text next to vertical colourbar, but is there a way to add text to top and bottom natively in ggplot, other than turning off text in the legend and adding with annotate() (and having to turn clipping off)? what i get >>>> vs what I want >>>> I'm sure I'm missing something simple. Code that gives me typical colourbar behaviour: df <- tibble(A = letters[1:5], B = 1:5) ggplot(df, aes(x = A, y = B, fill = B)) +

Comments

Sign in or sign up to comment and upvote.

No comments yet.