Skip to content

Secondary axis doesn't show axis ticks or labels with coord_trans #2990

Closed
@anthonytw

Description

@anthonytw

Exactly the same issue as #2072, which I take it was fixed since it is closed.

The secondary axis ticks and labels do not show up when coord_trans is present, even if using the identity transformation. The axis label ("name" parameter) does still appear.

For example, roughly taking from the examples in sec_axis:

ggplot(mtcars, aes(cyl, mpg)) + geom_point()  +
    scale_y_continuous(sec.axis = sec_axis(~.+10, name='MPG + 10'))

works as expected, but

ggplot(mtcars, aes(cyl, mpg)) + geom_point()  +
    scale_y_continuous(sec.axis = sec_axis(~.+10, name='MPG + 10')) +
    coord_trans()

loses the axis ticks and labels (but keeps the title "MPG + 10").

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions