Comments (5)
This is on CRAN now.
from cowplot.
Centering them on the tick marks seems impossible altogether.
from cowplot.
Yes. I'm pretty sure this is a bug in ggplot2 or grid. Similar problems arise without switching the axis position, correct?
from cowplot.
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.
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)
- align by axis values HOT 1
- Conversion failure warnings on unicode character HOT 3
- Label positioning is inconsistent HOT 1
- Rstudio crashed on iOS saving plots into tiff format HOT 6
- [Feature request] Icicle plot with ggplots objects
- Using expressions in plot text generates warnings
- Feature request: Add "units" parameter to all functions where size can be specified.
- Odd problem with setting alpha in an annotate geom
- [Feature request] Align legend with the start and end of the axis
- Cannot convert object of class LayerInstanceLayerggprotogg into a grob?
- changing size of the second plot in plot_grid() HOT 2
- ggarange common.legend positioning overwritten
- No side effect from plot_grid when used inside a function returning an object
- get_legend doesn't match original position
- Blank plot using plot_grid with RNotebook
- Feature request: options for anchors of labels in plot_grid HOT 1
- warning message: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0. HOT 5
- Explanation of how align_plot, ggdraw, and draw_plot work together for dual-y-axis plots.
- `draw_image` only works when background themes are set to `ggplot2::element_blank()` HOT 1
- Aligning legends?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cowplot.