简体   繁体   中英

ggplot2 polar plot axis label location

This is just a extension for a old question ggplot2 polar plot arrows 来自MatLab的指南针情节

You will find the x axis is out of the most_out circle. In ggplot2, I use "panel.grid.major = theme_line(colour = "black", size = 0.2, linetype=2)" to get the dashed circle, just as below: 使用GGplot2 So my question is how to make the axis label (180, 135, 90, .....) outside of the circle, because the text are merge with the circular lines.

I try to use "hjust" or "vjust" to adjust the distance between text and axis. But it does not work. So do you have some ideas about this problem? Thanks first!!!!

You have not provided code to reproduce the problem so this will be just a guess.

I've used whitespace, \\n in particular, to move text "away" in the past. Perhaps a custom formatter might work here. Here is how you can write a custom tick mark label formatter .

If this fails, you can always hide the axis labels and paint them yourself using geom_text by adding another layer.

Hope this helps. @hadley's book on ggplot2 is very good, by the way.

I came across this question while I was trying to fix a similar issue myself. One workaround is pretty much covered in the answer to this post: Remove extra space and ring at the edge of a polar plot

You would have to adjust the limits of the x scale to match your axis labels. You would also have to create a new scale bar corresponding to the radial length of your arrows (the 0-300 scale bar on the left side of your plot), since

axis.text = element_blank

takes the scale bar away as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM