Skip to content

hjust does not work with scale_y_continuous(position="right") #6266

Closed
@amongoodtx

Description

@amongoodtx

I have found that when I use scale_y_continuous(position="right"), setting hjust does not work in theme(axis.text.y = element_text(hjust=1)). The labels are always left-justified no matter how hjust is set. If I set position="left", then hjust=0 gives right-justified labels and hjust=1 gives left-justified labels as expected.

Here is the code to reproduce the bug:

set.seed(123)
df <- data.frame(var1=rnorm(56,mean=50,sd=50), var2=rnorm(56,mean=20))

ggplot(df, aes(var2,var1)) + geom_point() +
    theme(axis.text.y = element_text(hjust=1)) +
    scale_y_continuous(position="right") 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions