79374260

Date: 2025-01-21 11:51:43
Score: 2
Natty:
Report link

Just for anyone who stumbles across this – I found an easy solution to put the ticks outside the colorbar (as shown by @Serigne Mbacké Coly) and remove them on one side completely:

ggplot(mtcars, aes(x = cyl, y = gear, fill = mpg)) +
  geom_tile() +
  coord_equal() +
  theme(
    legend.position = 'top', 
    legend.ticks.length = unit(c(-.15, 0), 'cm'), # different lengths for ticks on both sides
    legend.ticks = element_line(color='black') # just to show the ticks on a white background
  )

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • User mentioned (1): @Serigne
  • Low reputation (0.5):
Posted by: Simon