Skip to content

Documentation of arguments to guide_axis is unclear #4958

Closed
@jarauh

Description

@jarauh
  1. Apparently, order has to be numeric. However, this is not checked. Passing a character simply gives a warning ("NAs introduced by coercion").
  2. There is no example of order nor of position.

I tried to add a secondary axis on the same side as the primary axis as follows:

ggplot(mtcars, aes(hp, mpg)) +
  geom_point() +
  scale_y_continuous(
    sec.axis = sec_axis(trans = ~ 235.215 / ., name = "l/100 km",
                        guide = guide_axis(order = 2, position = "left")))

This leads to a warning: "Discarding guide on merge. Do you have more than one guide with the same position?" And the secondary axis is not drawn. So it seems that I did not fully understand the use of order and position yet...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions