Git Product home page Git Product logo

Comments (3)

teunbrand avatar teunbrand commented on May 24, 2024 1

Some of these already have solutions.
To just put ticks on one side of the colourbar, set the size to 0 for one of the ticks:

library(ggplot2)

p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point()

p + theme(legend.ticks.length = rel(c(0.2, 0)))

To put ticks outside the bar, use negative tick lengths. If you make them too long, you might manually need to set the text margin for proper spacing.
I'm overriding legend.ticks because white ticks can't be seen on white background.

p + theme(legend.ticks.length = rel(-0.2)),
          legend.ticks = element_line())

Created on 2024-04-22 with reprex v2.1.0

from ggplot2.

teunbrand avatar teunbrand commented on May 24, 2024 1

Changing these defaults will probably affect a lot of people's plots, so I'd rather refrain from that unless there is an objective improvement to be made. Stylistic sensibility varies from person to person, so let's leave this as is for now.

from ggplot2.

davidhodge931 avatar davidhodge931 commented on May 24, 2024

Aha, thanks @teunbrand !

Feel free to close, if you think defaults should stay as is

from ggplot2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.