Skip to content

Unexpected results using guides(x = guide_axis(position = ...)) #4650

Closed
@jtlandis

Description

@jtlandis

When attempting to change the axis position with guide_axis it seems that the title is not correctly pulled unless manually specified.

library(ggplot2)

p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point() 

Currently you can swap the placement with scale_(x|y)_*(postion = ...) pretty reliably

p + scale_x_continuous(position = "top")

But trying to swap scales with guides() doesn’t seem to include the title

p + guides(x = guide_axis(position = "top"))

Even though the argument title = waiver() it doesn’t seem to work. But works when manually set.

p + guides(x = guide_axis(position = "top", title = "test"))

Created on 2021-10-27 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions