GithubHelp home page GithubHelp logo

Comments (5)

clauswilke avatar clauswilke commented on July 30, 2024 1

This is on CRAN now.

from cowplot.

Ax3man avatar Ax3man commented on July 30, 2024

Centering them on the tick marks seems impossible altogether.

from cowplot.

clauswilke avatar clauswilke commented on July 30, 2024

Yes. I'm pretty sure this is a bug in ggplot2 or grid. Similar problems arise without switching the axis position, correct?

from cowplot.

Ax3man avatar Ax3man commented on July 30, 2024

I don't think so. See this example:

ggplot(data = melted_cormat, aes(x=Var1, y=Var2, fill=value)) + 
  geom_tile() + theme_bw(base_size=20) +  xlab("")+ylab("")+
  theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5)) +
  coord_equal(expand = 0)

Here the alignment seems fine.

I've seen before that the justification can do weird things though. Would it be worth it to try and detect the 90 degree angle and make the adjustment?

from cowplot.

clauswilke avatar clauswilke commented on July 30, 2024

Ok, I get it now. It used to be that ggplot would simply ignore hjust and vjust when labels were rotated 90 degrees, but that seems to be fixed now. The problem is indeed the reversion of the axis. There is no generic code to invert a grid object, it's just a lot of manual fiddling.

If you look at lines 12, 13 and 28, 29 here, you can see how I'm inverting the hjust/vjust value and the x/y coordinate. To work with rotations, maybe we need to invert both hjust and vjust and x and y in all cases.

I don't like special-casing this so it works with 90 degrees. There must be a general transform that can be done. I don't think I'll have time to look into this any time soon, but if you want to investigate, those are the lines that will need to be changed.

from cowplot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.