infotroph / ggplotTicks

Copy axes from bottom to top and left to right sides of a ggplot.
Other
9 stars 1 forks source link

Update for ggplot2 >= 2.2.0 #7

Open infotroph opened 7 years ago

infotroph commented 7 years ago

In v 2.2, ggplot2 introduces major changes to the facetting system, breaking the hacky hooks that mirror_ticks was relying on... but also probably making this whole package irrelevant! Behold:

(ggplot(mpg, aes(displ, hwy)) 
    +  geom_point() 
    + theme_bw() 
    + scale_x_continuous("displ", sec.axis = sec_axis( ~ . , labels=NULL))
    + scale_y_continuous(""hwy", sec.axis = sec_axis(~ ., labels=NULL)) 

I will probably update ggplotTicks eventually to provide a convenient themed interface for this, but in the meantime you can get your mirrored-axis fix without my help!